我有这个结构
<accordion>
<accodrion-item>
<accordion-head [title]="'Header 1'"></accordion-head>
</accordion-item>
</accordion>
@Component({
selector: 'accordion-head',
template: '<h3 (click)="toggleItem($event)">{{ title }}</h3>
})
export class AccordionHead {
@Input() title;
@Output() handleToggleItem = new EventEmitter();
toggleItem() {
this.handleToggleItem.emit(this);
}
}
@Component({
selector: 'accordion-item',
template: '<ng-content></ng-content>'
})
@Component({
selector: 'accordion',
template: '<ng-content></ng-content>'
})
我想听听AccordionItem / Accordion组件中的handleToggleItem。这该怎么做?我不想使用任何服务。