Rijo Rijo - 1 year ago 172
AngularJS Question

How to get Angularjs Hidden field value without any button action?

I want get the angularjs hidden field value without any button action. I'm new in angularjs if any link available for this solution please send to me

Code given below

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app ng-controller="TestController">
<input type="hidden" name="id" ng-model="id" ng-init="id=12"></input>
function TestController($scope) {


Answer Source

Problem is, in controller alert is invoked before ng-init get set,

try this,

app.controller('myController', function($scope,$timeout) {
   $timeout(function() {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download