Troubles with importing classes from Angular 2 modules with Typescript 1.7

后端 未结 5 1693
情书的邮戳
情书的邮戳 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:23

    I had to make a couple edits to the 5 minute quickstart to get it working with MAMP.

    You've got to tell SystemJS where to find your custom modules, but you can't set baseURL to do it. Setting baseURL seems to mess up module resolution for the node modules(like angular). Add this to your systemjs config instead:

    map: {
        app: 'path/to/app/folder'
    },
    

    But don't change the angular import statements. Those aren't paths, they're module names and systemjs should resolve them just fine if you've included angular2.dev.js in a head script tag, as you have.

    You also may have to include:

    ///
    

    at the top of your app.ts(or wherever you call bootstrap)

提交回复
热议问题