I'm a newbie in AngularJS please help me out to find the issue , code shown below ( html code part - 1 with js code part-2) is working perfectly in my browser and I'm getting the alert.
Html Code
<a id={{data.id}} ng-click='onclickof("data")' class="item item-icon-left" >
{{data.name}} + {{data.id}}
</a>
Function defined on controller
$scope.onclickof= function(idinput){
alert(idinput);
}
But when I tried to pass the anchor tag id to my function its giving alert with 'undefined' string. Please check the code below.
Html code which passing id of anchor tag.
<a id={{data.id}} ng-click='onclickof(this.id)' class="item item-icon-left" >
{{data.name}} + {{data.id}}
</a>
Can anyone help me to find out the issue . Thanks in advance... :)
Just try ng-click='onclickof(data.id)'
You can also use your first example but without quotes like ng-click='onclickof(data)'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With