我想測試一個與AngularJS評估表達式的例子,但錯誤顯示:'未捕獲ReferenceError:角度未定義'(匿名函數) 我有兩個文件:index.html,然後expression.js 的index.html:未捕獲ReferenceError:角度未定義(匿名函數)
<script src="/home/mohamed/Desktop/AngularJS/expression.js"></script>
<script src="/home/mohamed/Desktop/AngularJS/angular.min.js"></script>
<div ng-controller="ExampleController" class="expressions">
Expression:
<input type='text' ng-model="expr" size="80"/>
<button ng-click="addExp(expr)">Evaluate</button>
<ul>
<li ng-repeat="expr in exprs track by $index">
[ <a href="" ng-click="removeExp($index)">X</a> ]
<code>{{expr}}</code> => <span ng-bind="$parent.$eval(expr)"></span>
</li>
</ul>
</div>
expression.js:
angular.module('expressionExample', []).controller('ExampleController', ['$scope', function($scope) {
var exprs = $scope.exprs = [];
$scope.expr = '3*10|currency';
$scope.addExp = function(expr) {
exprs.push(expr);
};
$scope.removeExp = function(index) {
exprs.splice(index, 1);
};
}]);
的可能的複製[什麼是「角度沒有被定義的」原因(http://stackoverflow.com/questions/ 18044519 /原因是角沒有定義) – Xufox