vic*_*woo 5 javascript angularjs
在angular.js中,$scope.greeting = xxx不起作用window.setTimeout.它没有任何影响:
var myApp = angular.module('myApp', []);
myApp.controller('MyCtrl', function ($scope) {
$scope.greeting = 'init';
window.setTimeout(function () {
console.log('update greeting');
$scope.greeting = "hello"; // doesn't work here.
}, 3000);
})
Run Code Online (Sandbox Code Playgroud)
为什么?
完整比较如下:
window.setTimeout):http://jsfiddle.net/victorwoo/3b3s6ukp/2/| 归档时间: |
|
| 查看次数: |
2258 次 |
| 最近记录: |