How do I pass ID value from hidden field in ng click function as parameter?
How do I pass ID value from hidden field in ng click function as parameter?
I am trying to get the id value from input hidden field and pass it as a parameter in ng-click function of a button.
id
ng-click
But I am getting empty string as Id.
Please help me.
<input id="Hidden1" type="text" ng-model="HiddenIdVal" ng-value="{{ac.ID}}" style="display: none;">
<p ng-show="{{ac.Active}}">
<input type="button" value="remove" ng-click="ShowConfirmBox(HiddenIdVal)" />
</p>
type=hidden
I was not really thinking. I fixed it. This is what I did .ng-click="ShowConfirmBox(ac.ID)". Thank you for reaching up.
– istudent
Jul 2 at 19:02
I don't think you need {{ brackets }} when you're using ng-value directive.Can you try
<input type="hidden" id="Hidden1" name="HiddenIdVal" type="text" ng-value="ac.ID">. Unable to test this right now but happy to help further tomorrow : )– Mausam
Jul 2 at 19:20
<input type="hidden" id="Hidden1" name="HiddenIdVal" type="text" ng-value="ac.ID">
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Can we see controller code please? Also, in order to get a real hidden input field use
type=hiddenon it. Docs here– Protozoid
Jul 2 at 18:57