0
在我們的組件HTML中,我們有一個帶參考名稱的模型。在這個模式中,我們有按鈕來關閉模式。在參考文獻中使用Angular模板
下面是代碼:
<div bsModal #confirmModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="confirm modal" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title pull-left">Confirm</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="confirmModal.hide()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<span>Are you sure ?</span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" (click)="confirmModal.hide()">Cancel</button>
<button type="button" class="btn btn-danger" (click)="confirmModal.hide()">Refresh Data</button>
</div>
</div>
</div>
</div>
要關閉它,我們現在稱之爲例如(click)="confirmModal.hide()"
。使用參考名稱。
由於我們是內參考#confirmModal
股利,是有可能,也許有一個方法來調用使用(click)="this.hide()"
當然我想這句法的隱藏功能,並沒有因爲工作據我所知,this
是指組件。
作爲一個獎勵:你有什麼想法在哪裏我可以找到Angular關於這個參考語法文檔#reference
的信息來命名我的html的一部分?我沒有完全知道它的所有可能性就使用它。
據我所知,'this'不在HTML範圍內。 – DeborahK