Below is my html:
<tr ng-repeat="c in client">
<td><input type =text id = "id" value = {{c.id}} onclick = "display();" > </input> </td>
<td><input type =text value = {{c.fname}}></td>
</tr>
My js:
function display()
{
var x=document.forms["form"]["id"].value;
alert(x);
}
I am getting the input value in the alert box successfully but how to get this value in another angular js function. I tried the below code but not working please suggest me
<input type =text id = "id" value = {{c.id}} ng-model = user.id ng-click ="init(user)" > </input>
If you have set up your application properly, you simply create the init()
function in your controller
$scope.init = function (user) {
// function implementation
};
Also make sure you format your HTML correctly
<input type="text" id="id" value="{{c.id}}" ng-model="user" ng-click ="init(user)" />
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