角4可折叠面板作为指示

时间:2017-07-21 22:49:49

标签: angular

我正在尝试使用为角度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;
        }
    }

http://plnkr.co/edit/ZoV0lzf14ibZk5pKQ1VO?p=preview

0 个答案:

没有答案