1
マイエラー:角2 - 属性ディレクティブ構文のエラー。何も見逃しましたか?
ERROR in C:/smartphoneSalesApp/src/app/test.directive.ts (9,3): Declaration expe
cted.
ERROR in C:/smartphoneSalesApp/src/app/dashboard/dashboard.component.ts (7,3): A
rgument of type '{ selector: string; templateUrl: string; directives: typeof tes
tDirective[]; }' is not assignable to parameter of type 'Component'.
Object literal may only specify known properties, and 'directives' does not ex
ist in type 'Component'.
マイ部品コード:
import { Component } from '@angular/core';
import { testDirective } from '../test.directive';
@Component({
selector: 'dashboard',
templateUrl: './dashboard.component.html',
directives: [testDirective]
})
export class DashboardComponent {
title = 'Welcome to Dashboard';
}
私はこのエラーを取得していますなぜ私は殿。私はディレクティブに関連する角コアモジュールをインポートする必要がありますか?
宣言:[AppComponent、DashboardComponent、SmartphoneListComponent、追加SmartphoneComponent、SmartphoneComponent、sortSmartphonePipe、testDirective、TestComponentComponent]、私はすでにそれを追加しました。 –
@PalzPal、それでいいです、コンポーネントからそれを取り除いてから –
はい削除しました。 C:/smartphoneSalesApp/src/app/test.directive.ts(9,3)のエラー:と書かれています。 –