我正在尝试使用为角度2.0完成的代码(下面)并在角度4上使用它并在我的项目中用于可折叠面板。它表示Panel
的类型组件中不存在指令import { Component } from '@angular/core';
import { Panel } from '../../components/shared/panel/panel'
@Component({
selector: 'alerts-panel',
templateUrl: './alerts.component.html',
styleUrls: ['./alerts.component.css']
directives: [Panel]
})
export class AlertsComponent {
}
import { Component, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'panel',
templateUrl: './panel.html',
styleUrls: ['./panel.css']
})
export class Panel {
opened: Boolean = false;
toggle() {
this.opened = !this.opened;
}
}