I have a button code block in jsp below which will pass $index of a selected checkbox to a javascript function in controller js which is defined on $scope. But when i try to print the $index on console i am getting undefined value for $index.
Code in Jsp
<button type="button" class="btn btn-warning"
ng-disabled='validCheckbox'
**ng-click="addTemplate($index)">**
<i class="glyphicon glyphicon-plus"></i> Add Middle
</button>
Code in Js.
$scope.addTemplate = function(index){
console.log("index"+index);
$indexis a special property of the ngRepeat scope. If you're not inside anngRepeat, there's no$index.