案例:AngularJS案例     状态:可编辑再运行    进入横版
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<script src="/js/angular.js1.4.6/angular.min.js"></script>
6
</head>
7
<body>
8
9
<div ng-app="myApp" ng-controller="costCtrl">
10
11
数量: <input type="number" ng-model="quantity">
12
价格: <input type="number" ng-model="price">
13
14
<p>总价 = {{ (quantity * price) | currency }}</p>
15
16
</div>
17
18
<script>
19
var app = angular.module('myApp', []);
20
app.controller('costCtrl', function($scope) {
21
    $scope.quantity = 1;
22
    $scope.price = 9.99;
23
});
24
</script>

 运行结果 
 北美留学生论坛