我第一次在jsFiddle中编写AngularJs代码而无法运行代码。
HTML代码: -
<div ng-app="eshopApp" ng-controller="checkoutCtrl">
<button ng-click="testTask()">Test</button>
</div>
js代码: -
var eshopApp = angular.module('eshopApp', []);
eshopApp.controller('checkoutCtrl', function ($scope, $rootScope) {
$scope.testTask=function(){
alert('working');
}
});
请找到jsFiddle链接http://jsfiddle.net/clsah/onbg6y6a/