我是Angular和依賴注入的新手。我在頁面加載時收到以下錯誤。我試圖在.Net/MVC4中創建一個表單嚮導,如this example。任何幫助是極大的讚賞。使用ngAnimate作爲依賴項時出現MVC4&AngularJS錯誤
Uncaught Error:[$注射器:unpr]未知提供商:$$ qProvider < - $$ q < - $動畫< - $編譯
腳本鑑於磁頭裝載:
<script src="@Url.Content("/Scripts/bower_components/angular/angular.js")"></script>
<script src="@Url.Content("/Scripts/bower_components/angular-ui-router/release/angular-ui-router.js")"></script>
<script src="@Url.Content("/Scripts/bower_components/angular-animate/angular-animate.js")"></script>
<script src="@Url.Content("/Scripts/modules/long-form-app-module/LongFormApp.js")"></script>
<script src="@Url.Content("/Scripts/modules/long-form-app-module/LongFormController.js")"></script>
HTML標記
<div class="application">
<!-- Inject partial view from router -->
<section ui-view></section>
</div>
LongFormApp.js腳本
(function() {
'use strict';
// Create our app and inject ngAnimate and ui-router
angular.module('GllApp', ['longFormController'])
.config(function ($stateProvider, $urlRouterProvider) {
// Catch all route
// By default send user to question one
$urlRouterProvider.otherwise('/home');
$stateProvider
// Route to show start of form
.state('home', {
url: '/home',
templateUrl: 'LongForm.html',
controller: 'LongFormController'
})
// Route to show start of form
.state('home.q01', {
url: '/home/q01',
templateUrl: 'LongFormQuestion01.html'
});
});
})();
LongFormController.js腳本
(function() {
'use strict';
angular.module('longFormController', ['ngAnimate', 'ui.router'])
.controller('LongFormController', ['$scope', function ($scope) {
// do stuff
}]);
})();
你有angular.module('GllApp',['longFormController'] ...你有一個名爲longFormController的模塊?也有,語法錯誤?(IE LongFormController)。 – dannypaz 2014-10-16 19:34:25
我用上面的代碼更新了代碼我仍然收到相同的錯誤 – 2014-10-16 21:06:29