Angular2/ASP.NET - “No ResourceLoader implementation has been provided. Can't read the URL”

前端 未结 7 1257
名媛妹妹
名媛妹妹 2021-02-13 19:24

I\'m trying to build my own Angular 2/ASP.NET SPA on Visual Studio. You can find all the files here.

What I tried to do is simple: after I followed the instructions to

相关标签:
7条回答
  • 2021-02-13 19:40

    In my case I solved the issue by removing the hyphen from component's name: product-list.component => wrong productlist.component => OK

    0 讨论(0)
  • 2021-02-13 19:41

    The UniversalModule currently requires that external assets for templates and styles use require().

    Try changing templateUrl: './test.component.html' to template: require('./test.component.html').

    And styleUrls: ['./test.component.css'] to styles: [require('./test.component.css')]

    More details on the issue can be found here: Unable to load assets without using require()

    For reference, here is the issue thread from Angular on Github: track runtime styleUrls. They recommend using the angular2-template-loader.

    0 讨论(0)
  • 2021-02-13 19:46

    I run into this and in my case the problem was from an upgrade of angular2-templeate loader. The new version "0.6.1" caused this error to appear. I introduced the previous version "0.6.0" and everything worked ok.

    0 讨论(0)
  • 2021-02-13 19:47

    This issue occurs from angular2-template-loader with SSR and there are a couple of reasons why this issue appears:

    • Important: Check if angular2-template-loader is up to date.

    Usually, all the issues are related with @Component.

    • As Will mentioned - in component name. (this has been fixed)
    • Comments within @Component
    0 讨论(0)
  • 2021-02-13 19:49

    Check your webpack version (in a command line window, run webpack --version), if it's 1.XX then install the latest version of webpack 2 (2.2.X) and run it on the solution folder, and try again

    0 讨论(0)
  • 2021-02-13 19:55

    My problem was I'm a webpack noob and tried to execute a tsc command which as per Steve Sanderson:

    causes VS to spew garbage .js files all over your source directories...

    The fix is to

    1. Clean up any *.js and *.js.map files
    2. Ensure <TypeScriptCompileBlocked> is true in the *.csproj
    3. Try running project again
    0 讨论(0)
提交回复
热议问题