Angularjs实例应用

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible"content="edge" />
<meta name="viewport"content="width=device-width,initial-scale=1" />
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet"href="bootstrap/css/bootstrap.min.css" />
<style>

</style>
</head>
<body>
<div class="container"style="padding:50px">
<div data-ng-app="myApp"data-ng-controller="myCtrl">
<p>数量:<input type="number"data-ng-model="quantity" /></p>
<p>成本:<input type="number"data-ng-model="cost" /></p>
<hr />
<p>总价格:{{quantity*cost | currency}}</p>

</div>


</div>

<script src="jQuery/jquery-2.2.0.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
angular.module("myApp", []).controller("myCtrl", function ($scope) {
$scope.quantity = 10; $scope.cost = 9.8;
})
</script>
</body>
</html>

posted @ 2016-01-09 16:58  melao2006  阅读(153)  评论(0编辑  收藏  举报