Angular 2 bootstrap function gives error “Argument type AppComponent is not assignable to parameter type Type”

后端 未结 9 796
长情又很酷
长情又很酷 2021-02-01 13:14

Here is my first simple Hello World angular 2 app from Angular 2 quick start guide.

import {Component} from \'angular2/core\';
import {bootstrap} fr         


        
相关标签:
9条回答
  • 2021-02-01 13:59

    adding comment / annotation like shown below solves the problem

    //noinspection TypeScriptValidateTypes
    bootstrap(AppComponent);
    
    0 讨论(0)
  • 2021-02-01 13:59

    The above answer did not work for me. I was able to fix it by doing what was recommended in the comments above.

    bootstrap(<any>AppComponent);
    

    I am using Intellij 14.1.5

    0 讨论(0)
  • 2021-02-01 14:08

    For the new angular2 router I had to do ..

    bootstrap(AppComponent [
        <any>APP_ROUTER_PROVIDERS
        ]).catch((err:any) => console.error(err));
    

    NOTE any is used on APP_ROUTER_PROVIDERS not AppComponent.

    0 讨论(0)
提交回复
热议问题