如果不太清楚 AngularJS 的測試,可以看 http://programer-learn.blogspot.com/2014/10/angularjs-unit-testing.html
以下是本次範例的頁面,在 Text Box 輸入名子,按下 Button 後,Text Box 的值就會改變
接下來看一下原始碼 (index.html)
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="sampleApp">
<head>
<title>Demo</title>
<script type="text/javascript" src="lib/angular.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</head>
<body>
<div ng-controller="SampleCtrl">
Name:<input type="text" ng-model="name"/>
<br/><button ng-click="echo()">Echo</button>
</div>
</body>
</html>