【发布时间】:2017-10-28 17:42:00
【问题描述】:
我有一个按钮
<button ion-button icon-left name="0x10000011 (click)="AppService.sendNotify($event)" id="0x10000011" value=1>
<ion-icon name="camera"></ion-icon>
CAM Icon
</button>
当我点击它时,我想在我的服务sendNotify 函数中获取id 属性。
public sendNotify(data) {
var method = 'SCAN_BUTTON';
var name = data.target.name;
var id = data.target.id;
var value = data.target.value - 0;
console.log("#$#$%$%^$%^#$%^#$%",method, name, value);
}
这里我没有得到按钮 id 和 name。而是
#$#$%$%^$%^#$%^#$% SCAN_BUTTON undefined NaN.
谁能帮我找出我的错误?
【问题讨论】:
-
为什么不直接将您的姓名/ID 作为函数的参数发送?
-
检查我的答案
标签: javascript angular ionic-framework ionic2