0
我想傳遞孩子模態到我的父函數。我已經使用這個Modal傳遞孩子ID到父函數角2
app.html
<div class="head"><button class="headbtn" (click)="Popup(modal)">Add</button></div>
<div>
<div class="centerDiv text-center" *ngFor="let hero of list">
<div>
<button class="glyphicon glyphicon-trash operation"></button>
<button class="glyphicon glyphicon-pencil operation" (click)="Popup(modal)"></button>
</div>
<div><h4>{{hero.Name}}</h4></div>
</div>
</div>
<custom-modal></custom-modal>
customModal.html
<modal #modal> <---- this Modal
<modal-header [show-close]="true">
<h4 class="modal-title">I'm a modal!</h4>
</modal-header>
<modal-body>
Hello World!
</modal-body>
<modal-footer [show-default-buttons]="true"></modal-footer>
app.component.ts
export class AppComponent {
list = [{ "Name": "App 1" }];
Popup(modal) { <--- I am getting this modal undefined.
debugger;
modal.open();
}
}
我怎樣才能做到這一點?