angular2遇到的问题.md

  1. 在组件时moduleId: module.id时,报Cannot find name 'module'?

    解决方法:

    You need to install node ambientDependencies. Typings.json

    "ambientDependencies": {
        "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#138ad74b9e8e6c08af7633964962835add4c91e2"
    }
    

    Another way can use typings manager to install node definition file globally:

    typings install dt~node --global --save
    

    Then your typings.json file will look like this:

    "globalDependencies": {
          "node": "registry:dt/node#6.0.0+20160608110640"
    }
    

    If you use Typescript 2^ just use the following command:

    npm install @types/node --global --save
    

    Or install it within the project:

    npm install @types/node --save
    

    and then add a reference to it from your bootstrap:

    ///<reference path="../../node_modules/@types/node/index.d.ts" />
    
  2. 而后出现Url.match is not a function?

    解决方法:

  3. 报错:Property 'find' does not exist on type 'Hero[]'.?

    解决方法:在typings.json中配置如下代码

    {
          "globalDependencies": {
            "core-js": "registry:dt/core-js#0.0.0+20160725163759",
            "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
               "node": "registry:dt/node#6.0.0+20160909174046"
          }
    }