How to send the input text box value to angularjs onclick on the text box?

angularjs, html

Solution

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)" />

Problem

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> ```

Original source