I created basic application based on angularjs
HTML:
<div ng-app="miniapp">
<div ng-controller="Ctrl">
My name is
<input type="text"/>
Val: {{val}}
<br/>
<button ng-disabled="val">Submit</button>
</div>
JS:
var app = angular.module('miniapp', []);
var glob;
function Ctrl($scope) {
glob = $scope;
$scope.val = false;
window.setTimeout(function() {
$scope.val = true;
}, 3000);
}
window.setTimeout(function() {
glob.val = true;
}, 3000);
As you can see I try to change val
to true
after 3 sec by 2 ways but no one is working for me. Really strange. Did I miss something?
Actually I try to change value after get response from Ajax, but suppose should be the same problem.
Thanks,
Here is my example: http://jsfiddle.net/6uKAT/20/
question from:
https://stackoverflow.com/questions/16069309/how-to-change-value-after-delay-by-using-angularjs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…