我寫(xiě)了一段簡(jiǎn)單代碼,使用了angular js,可是不知道為什么,程序并沒(méi)有響應(yīng)我的代碼,代碼如下:<!DOCTYPE html><html ng-app>
<head>
<title>js </title>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<table ng-controller="BasketCtrl">
<tr><td>Item:</td><td>{{description}}</td></tr>
<tr><td>cost:</td><td>{{cost}}</td></tr>
<tr><td>qty:</td><td><input type="number" ng-model="qty"></td></tr>
<tr><td>subtotal:</td><td>{{qty * cost|currency}}</td></tr>
</table>
<script src="./js/test1.js"></script>
</body></html>test1.js是我自己定義的一小段js:function BasketCtrl($scope) {
$scope.description='Singe ticket';
$scope.cost=8;
$scope.qty=1;
}然而,似乎并不能正確運(yùn)行:那個(gè)cdn是用的網(wǎng)上一個(gè)叫“菜鳥(niǎo)教程”所提供的,沒(méi)有問(wèn)題。作為新手實(shí)在是不明白自己這段代碼的問(wèn)題所在,希望有朋友和大神可以指出,謝謝~
簡(jiǎn)單問(wèn)題:為什么angular js無(wú)法正常工作?
蝴蝶不菲
2018-10-16 13:31:23