하위 구성 요소에서 버튼을 클릭하면 @Output
지시문을 사용하여 부모 구성 요소에 알리려고합니다. 다음은 내 코드입니다 :각도 - @ 출력이 작동하지 않습니다.
부모보기
<app-perito-select *ngIf="peritoSelect" (cancel)="cancelPeritoAction()"></app-perito-select>
부모 컨트롤러
...
cancelPeritoAction(){
console.log('cancel inside parent');
this.selectedAction = undefined;
}
아이 컨트롤러
...
@Output() cancelAction: EventEmitter<any> = new EventEmitter<any>();
...
cancel(){
console.log('cancel inside child');
this.cancelAction.emit();
}
튜토리얼 this을 따라 갔는데 아주 단순 해 보였지만 부모 함수에 도달하지 못했습니다. 내가 뭘 놓치고 있니? 감사.