AngularJS Example: async text field update
This example demonstrates what I think is a bug, where the text field is uneditable after an asynchronous update.
by sonicsage
HTML
<div ng-app="app" ng-controller="root">
<h3 ng-hide="user">Not yet loaded</h3>
<input ng-model="user.name"/>
</div>
JavaScript
angular.module('app', []).
factory('user', function($timeout,$q) {
var value = $timeout(function(){ //Simulate a request
return {
name: "Jossi"
};
},1000);
return {
value: value
};
}).
controller('root',function($scope, user) {
$scope.user = user.value;
});