我是Angular 2.我正在做YouTube教程,但每个教程都有指令:我被卡住的部分。
app.component.ts
import { Component } from '@angular/core'; import { HeaderComponent } from './components/header/header.component' @Component({ selector: 'my-app',template: '<h1>Hello</h1><header></header>',directives: [HeaderComponent] }) export class AppComponent { }
Argument of type '{ selector: string; template: string; directives: typeof HeaderComponent[]; }' is not assignable to parameter of type 'ComponentMetadataType'.at line 6 col 3
header.component.ts
import { Component } from '@angular/core'; @Component ({ selector: 'header',template: '<h2>hit!</h2>' }) export class HeaderComponent { }
以下是错误的屏幕截图