您的位置:首页 > Web前端 > AngularJS

AngularJs 简单数据绑定

2016-04-07 14:18 555 查看
/homePage.html
<div class="homePageBody">
<div>Value = {{ testValue}} </div>
</div>

//homePage.js
angular.module('myApp.test', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'views/homePage/homePage.html',
controller: 'homePageController'
});
}])

.controller('homePageController', ['$scope', '$timeout', function($scope, $timeout) {

$scope.testValue = 100;

// ....
$timeout(function() {
$scope.testValue = 200;
}, 1000);

// ...
}]);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: