Troubles with importing classes from Angular 2 modules with Typescript 1.7

后端 未结 5 1724
情书的邮戳
情书的邮戳 2020-12-31 03:14

I am having some trouble understanding how to import classes from Modules in TypeScript, specifically for Angular 2 in Visual Studio 2015 (update 1) with TypeScript 1.7.

5条回答
  •  不知归路
    2020-12-31 03:45

    How does your HTML file load the Angular 2 library? It should be as simple as

    You'll notice that file contains the entirety of the built/concatenated Angular 2 library. You shouldn't point your web page at the raw source files.

    SystemJS knows what angular2/core means because the built library defines what that pattern means. Although it appears to be some directory structure (which it probably is in the unbuilt library) it's actually just some name for a module the built library. Search for this text in the built library and you'll see it defined:

    System.register("angular2/core", ...

提交回复
热议问题