を動作しません:Emit event from Directive to Parent element : Angular2EMITイベントの角2は、質問へのフォローアップとして、
構造ディレクティブは、イベントを発したときに、親コンポーネントがそれを受信しないように見えます。
@Directive({ selector: '[appWidget]' })
export class WidgetDirective implements OnInit{
@Output() wdgInit: EventEmitter<any> = new EventEmitter();
@Input() set appWidget (wdg: any) {
//display stuff
}
ngOnInit {
this.wdgInit.emit();
}
widget.component.html:
<ng-container *ngFor="let wdg of widgets">
<div *appTwitterWidget="wdg" >
<ng-container>
widgetContainer.component.html:この場合
<app-widget [widgets]="widgetList" (wdgInit)="containerDoSomthing()"></app-widget>
私は決して呼び出されないばかりcontainerDoSomthing()を見つけます。