【发布时间】:2018-08-13 13:55:49
【问题描述】:
我正在使用父子组件。在子组件中,我使用搜索框。我需要随时按需获取搜索框值。这个怎么弄?
子组件 html - GridViewComponent
<input id="successFilter" name='filterInput' type="text" (keyup)="searchSuccess($event)">
父组件 ts
@ViewChild(GridviewComponent) grdView: GridviewComponent;
在构造函数之前写上一行
this.grdView.filterInput.subscribe(data => {
console.log(data);
});
无法获取输入值
【问题讨论】:
-
发布您的代码,向我们展示您的尝试。
-
Parent 将输入传递给 Child 组件Child 将输出事件发送给 Parent,我希望你的意思是这样的
标签: javascript angular angular5 angular-components