标签:strong 实例 har rip string app bsp 应用 cdn
AngularJs表达式
AngularJs表达式写在双大括号内:{{expression}}
AngularJS表达式把数据绑定到HTML,与ng-bind指令有 异曲同工之妙
AngularJS将在表达式书写的位置“输出”数据
AngularJS很像JavaScript表达式:他可以包含文字、运算符和变量
实例:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<p>尝试修改以下表单。</p>
<div ng-app="myApp" ng-controller="myCtrl">
名: <input type="text" ng-model="firstName"><br>
姓: <input type="text" ng-model="lastName"><br>
<br>
姓名: {{firstName + " " + lastName}}
</div>
<script>
var app = angular.module(‘myApp‘, []);
app.controller(‘myCtrl‘, function($scope) {
$scope.firstName= "John";
$scope.lastName= "Doe";
});
</script>
</body>
</html>
AngularJS模块定义应用:
AnjularJS模块
var app = angular.module(‘myApp‘,[]);
AngularJS控制器控制应用:
AnjularJS控制器:
app.controller(‘myCtrl‘,function($scope){
$scope.firstName = "John";
$scope.lastName = "Doe";
})
标签:strong 实例 har rip string app bsp 应用 cdn
原文地址:http://www.cnblogs.com/sy-liu/p/6754657.html