[英]How to use ActivateRoute's query params map to initiate a navigation map and vice-versa?
[英]ionic 4 - how to call component method and vice-versa
我以這種方式在頁面中添加了我的組件:
<app-modal-product></app-modal-product>
那么,如何調用組件內部的方法,以及如何從組件調用父頁面方法呢?
將引用變量添加到您的組件。
<app-modal-product #modalproduct></app-modal-product>
獲取父組件中的組件引用。
@ViewChild('modalproduct') modalProduct;
在引用上調用組件方法。
this.modalProduct.methodName();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.