這AngularJS功能無法正常工作完全不一樣的我就指望它:AngularJS函數調用使用數組
app.controller('MainController', ['$scope', 'ForTHEOrder', function($scope, commence) {
commence.success(function(boolean) {
$scope.rabbitCat = boolean;
$scope.clownFox = boolean;
$scope.mongolFaun = boolean;
$scope.deerWolf = boolean;
$scope.stoatFire = boolean;
$scope.bearDragon = boolean;
$scope.deadWeasel = boolean;
$scope.n_nUrsulafox = boolean;
});
commence.failure(function(boolean) {
$scope.rabbitCat = boolean;
$scope.clownFox = boolean;
$scope.mongolFaun = boolean;
$scope.deerWolf = boolean;
$scope.stoatFire = boolean;
$scope.bearDragon = boolean;
$scope.deadWeasel = boolean;
$scope.n_nUrsulafox = boolean;
});
}]);
應傳遞一個數組進函數調用,含有一組對象,這是然後由嵌套函數調用使用。但是,這似乎並不是實際發生的事情,當我嘗試運行代碼時出現錯誤。如果需要,我可以發佈HTML,但是令我感興趣的是數組的操作。有沒有人有關於陣列在這裏做什麼的建議?
我目前得到以下錯誤信息:
Error: $scope.success is not a function
@http://www.orderofthemouse.co.uk/js/controllers/MainController.js:102:3
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:36:338
Ce/this.$get</</<@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:75:387
H/<@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:59:19
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:7:406
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:59:2
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:51:299
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:51:316
C/<@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:50:414
rc/d/</<@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:17:477
Me/this.$get</[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:125:116
Me/this.$get</[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:125:330
rc/d/<@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:17:435
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:36:338
rc/[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:17:356
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:18:151
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:16:463
@http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:249:238
[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:164:4
gf/[email protected]://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:32:280
請求的HTML代碼如下:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>The Order of the Mouse</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/jpg" href="./ico/favicon.jpg">
<meta name="description" content="Psychological horror/detective/spiritual RPG set the medieval, magical future world of 2079; Web-Based">
<meta name="keywords" content="RPG, Horror, Detective, Order of the Mouse, Rabbit-Cat, Dragon-Bear, Clown-Fox, Deer-Wolf">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/style.css">
<script src="./vendor/jquery-1.11.3.min.js"></script>
<script src="./vendor/bootstrap.min.js"></script>
<script src="./vendor/underscore.js"></script>
<script src="./vendor/backbone.min.js"></script>
<script src="./vendor/backbone.marionette.min.js"></script>
<script src="./react/build/react.min.js"></script>
<script src="./react/build/react-dom.min.js"></script>
<script src="http://www.wavepot.com/build.js"></script>
<script src="http://www.wavepot.com/app.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<link href='https://fonts.googleapis.com/css?family=Roboto:500,300,700,200' rel='stylesheet' type='text/css'>
<link href="css/main.css" rel="stylesheet" />
</head>
<body ng-app="myApp">
<div class="header">
<div class="container">
<h1></h1>
</div>
</div>
<div class="main" ng-controller="MainController">
<div class="container">
<h1>{{ title }}</h1>
<h2>{{ placeholder }}</h2>
<div ng-repeat="character in characters" class="col-md-6">
<div class="thumbnail">
<img ng-src="{{ }}">
<p class="name">{{ character.name }}</p>
<p class="name">{{ character.age }}</p>
<p class="url"><a href="http://orderofthemouse.co.uk/">{{ character.url }}</p></a>
<p class="coolness">{{ success.rabbitCat }}</p>
<p class="warmness">{{ failure.rabbitCat }}</p>
<div class="HP">
<p class="Up" ng-click="plusOne($index)"> {{ }} </p>
<p class="Down" ng-click="minusOne($index)"> {{ }} </p>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="container">
<h2></h2>
<img style="display: none" src="" width="" />
</div>
</div>
<script>
import sin from '<redacted>';
import { noise } from '<redacted>';
export function dsp(t) {
return (sin(t, 440) + noise()) * 0.1;
}
</script>
<audio controls autoplay>
<source src="DozyOuija.ogg" type="audio/ogg">
<source src="DozyOuija.mp3" type="audio/mp3">
<p>Your User Agent does not support the HTML5 Audio element.</p>
</audio>
<!-- Modules -->
<script src="js/app.js"></script>
<!-- Controllers -->
<script src="js/controllers/MainController.js"></script>
<script>
<!-- Analytics -->
<!-- ANALYTICS REDACTED -->
</script>
</body>
</html>
讓我知道,如果有人需要進一步的細節,以幫助他們水落石出的問題。
* 「我得到一個錯誤」 *。你認爲這個錯誤可能有什麼意義嗎? – dfsq
它輸出一個錯誤,說明$ scope的數組未定義,然後顯示{{rabbitCat.boolean}}而不是顯示布爾值。 –
現在顯示稍微不同的錯誤。修改信息以反映。 –