我不斷收到標題中提到的錯誤。我曾嘗試閱讀關於錯誤的Angular文檔,並且似乎我將一切正常。
我有3個模塊App.js,planCtrl.js和gservice.js和連接它們像下面
的index.html
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Google Libraries -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDvkISJD8ay_X92_2BJxoe1k15ICtGFf5o&libraries=places"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script src="https://code.angularjs.org/1.5.0/angular.min.js"></script>
<script src="https://code.angularjs.org/1.5.0/angular-route.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0/angular-cookies.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-messages.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.1.2/ui-bootstrap-tpls.js"></script>
<script src="js/app.js"></script>
<script src="js/planCtrl.js"></script>
<script src="js/gservice.js"></script>
app.js
var chaloApp = angular
.module('chaloApp', [
'planCtrl', 'gservice', 'ngCookies',
'ngRoute', 'ngMessages', 'ui.bootstrap'
]);
plan.js
個var planCtrl = angular.module('planCtrl', ['gservice']);
planCtrl.controller('planController', ['$scope', '$rootScope', '$http', '$cookies', '$location', '$compile', '$uibModal', 'gservice', function($scope, $rootScope, $http, $cookies, $location, $compile, $uibModal, gservice){
gservice.js
angular.module('gservice', [])
.factory('gservice', ['$scope', '$rootScope', '$http', function($scope, $rootScope, $http){
以下是完整的錯誤,如果需要的細節。
Error: [$injector:unpr] http://errors.angularjs.org/1.5.0/$injector/unpr?p0=<div class="routePages ng-scope" ng-view="">copeProvider%20%3C-%20%24scope%20%3C-%20gservice
at Error (native)
at https://code.angularjs.org/1.5.0/angular.min.js:6:416
at https://code.angularjs.org/1.5.0/angular.min.js:43:7
at Object.d [as get] (https://code.angularjs.org/1.5.0/angular.min.js:40:270)
at https://code.angularjs.org/1.5.0/angular.min.js:43:69
at d (https://code.angularjs.org/1.5.0/angular.min.js:40:270)
at e (https://code.angularjs.org/1.5.0/angular.min.js:41:1)
at Object.invoke (https://code.angularjs.org/1.5.0/angular.min.js:41:86)
at Object.$get (https://code.angularjs.org/1.5.0/angular.min.js:38:460)
at Object.invoke (https://code.angularjs.org/1.5.0/angular.min.js:41:295)
一直在努力與這一點點,所以感謝任何幫助。
感謝,
你可以顯示你正在加載的腳本的其餘部分嗎? –
https://docs.angularjs.org/error/$injector/unpr?p0=%3Cdiv%20class%3D%22routePages%20ng-scope%22%20ng-view%3D%22%22%3EcopeProvider%20%3C - %20 $範圍%20%3C-%20gservice –
首先包含gservice。 –