【发布时间】:2017-05-28 07:18:27
【问题描述】:
我正在尝试以角度 2 将数据从一个组件发送到另一个组件。我的@output is not working。我在列表中添加项目。点击row。我正在将数据从一个组件发送到另一个组件。
这是我的代码
https://plnkr.co/edit/sG6Suhnvc3Qmjmqjym67?p=preview
我喜欢这样,
@Output() userUpdated = new EventEmitter();
liClick(item){
this.userUpdated.emit(item)
}
这为什么不被解雇?
userSelected(items){
alert(items);
this.title="user is selected" +item.name;
}
【问题讨论】:
-
liClick在哪里调用? -
对@suraj,liClick在哪里调用?
-
误会换pluker版本
-
plnkr.co/edit/4zIzOsjiP3WdRj8EayKe?p=preview 你的函数中有错字
userSelected(item){ this.title="user is selected" +item.name; }
标签: angular