I am trying to set the value of a $scope property using ng-init, and I am unable to access that value in the controller's javascript. What am I doing wrong? Here is a fiddle: http://jsfiddle.net/uce3H/
markup:
<body ng-app>
<div ng-controller="testController" >
<input type="hidden" id="testInput" ng-model="testInput" ng-init="testInput='value'" />
</div>
{{ testInput }}
</body>
javascript:
var testController = function ($scope) {
console.log($scope.testInput);
}
In the javascrippt, $scope.testInput is undefined. Shouldn't be 'value'?