Stack Exchange
angular js specify ng-model dynamically and access that text box value back
I need to assign a ng-model to an input dynamically and retrieve all text box the value on button click.  alert(x.WeekNumber) is not giving value
template
<table class="table-bordered">   
    <tr ng-repeat="x in weekOneData">
        <td>{{x.dayDate}}</td>
        <td><input type="number" value="0" id="x.WeekNumber" />{{x.WeekNumber}}</td>
    </tr>
</table>

<button class="btn btn-default" ng-click="TestFunction()">testing</button>

controller
 $scope.weekOneData = [];
for (var index = 1; index <= 7; index++) {
    var ob = new Object();
    ob.dayDate = formattedDate;
    ob.WeekNumber = index;$scope.weekOneData[index - 1] = ob;
   }
$scope.TestFunction = function () {
  //  sum=textbox1+textbox2+textbox3
}


It is not clear to me what you want to achieve with this code. But the problem is that you reference x outside of the ng-repeat scope. Try this:
<table class="table-bordered">   
    <tr ng-repeat="x in weekOneData">
        <td>{{x.dayDate}}</td>
        <td><input type="number" value="0" id="x.WeekNumber" />{{x.WeekNumber}}
        <button class="btn btn-default" ng-click="TestFunction(x)">testing</button></td>
    </tr>
</table>

Here is a 'working' example:
http://plnkr.co/edit/aiWasYUnV19d7JMPnjJZ?p=preview

Hi Mark  my button is outside the ng-repeat  i want to get all textbox value (user entered values) on button click
