我的错误:
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';
}
我不知道为什么我会收到此错误。我是否需要导入与指令相关的任何角度核心模块.. ??
答案 0 :(得分:0)
您的代码存在两个问题:
@Component
装饰器不再支持@NgModule
@Directive({se... 'onMouseLeave()'}}); <----