这是我的第一个简单的Hello World
角度 2 应用程序来自Angular 2 快速入门指南 https://angular.io/docs/ts/latest/quickstart.html.
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
@Component({
selector: 'ng2-app',
template: '<h1>My first Angular 2 App</h1>'
})
export class AppComponent { }
bootstrap(AppComponent);
当我运行时应用程序运行良好npm start
但我的 IntelliJ IDE 在以下行中显示错误bootstrap(AppComponent)
参数类型应用组件不可分配给参数类型Type
看着bootstrap
函数声明,AppComponent
需要延长Type
.
export declare function bootstrap(appComponentType: Type, customProviders?: Array<any>): Promise<ComponentRef>;
我的问题是:
Angular 组件是否有望扩展Type
?
我在 Intellij 2016.1.2 中通过 Angular 快速入门演示偶然发现了这一点。在 IDE 中设置以下选项会有所帮助:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)