I'm developing an app and I've a table populated with ng-repeat
and the last column of the table is an image that it is clicked open another page that should contains more details about the line of the table that I've choose clicking the image.
I've tried to use an input type hidden in a form but it doesn't work for me.
This is my code:
<tr ng-repeat="Data in response">
<td align="center">{{Data.date}}</td>
<td align="center">{{Data.conf}}</td>
<td align="center">{{Data.evaso}}</td>
<form ng-submit="submit()">
<input type="hidden" name="codice" value="Data.code" ng-model="codice">
<td align="center"><input type="image" src="img/note.png" class="imageNote" ng-click="submit()"></td>
</form>
</tr>
After in the controller I need to manage this data (the cod). But in this way, I've tried to print it in the console and the result is undefined
.
How can I solve this problem?
I am not sure if I get your question, but if you want to pass the selected item to the submit function, you can have your angular function like this:
$scope.submit = function(selectedId){
console.log(selectedId);
//Your code.
}
and your HTML should change to this:
<input ng-click="submit(Data.id)" type="image" src="img/note.png" class="imageNote">
Note: You do not need to use {{}}
(expressions) to pass something to a function (here, ng-click)