Javascript 未知提供程序错误,尽管其他控制器和服务正在工作

Javascript 未知提供程序错误,尽管其他控制器和服务正在工作,javascript,angularjs,dependency-injection,angular-ui-router,angularjs-service,Javascript,Angularjs,Dependency Injection,Angular Ui Router,Angularjs Service,这就是我的app.js的样子,我已经为所有模板定义了状态、控制器和URL: angular.module('starter', ['ionic', 'starter.controllers','starter.services']) .run(function($ionicPlatform) { $ionicPlatform.ready(function() { // Hide the accessory bar by default (remove this to show th

这就是我的app.js的样子,我已经为所有模板定义了状态、控制器和URL:

angular.module('starter', ['ionic', 'starter.controllers','starter.services'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    ionic.Platform.fullScreen()
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      // StatusBar.styleDefault();
      StatusBar.hide();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

  .state('app', {
    url: "/app",
    abstract: true,
    templateUrl: "templates/rubyonic/menu.html",
    controller: 'AppCtrl',
    reload: true
  })

  // .state('login', {
  //   url: "/login",
  //   templateUrl: "templates/rubyonic/login.html",
  //   controller: 'AppCtrl'
  // })

  .state('login', {
        url: '/login',
        templateUrl: "templates/rubyonic/login.html",
        controller: 'LoginCtrl'
    })


  .state('app.alerts', {
    url: "/alerts",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/alerts.html",
        controller: 'AppCtrl'
      }
    }
  })

   .state('app.studies', {
    url: "/studies",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/studies.html",
        controller: 'AppCtrl',
        reload: true
      }
    }
  })

   .state('app.study_collections', {
    url: "/studies/:studynodeRef",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/overview.html",
        controller: 'AppCtrl',
        reload: true
      }
    }
  })



  .state('app.rank-charts', {
    url: "/rank_charts",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/rank_charts.html",
        controller: 'AppCtrl'
      }
    }
  })

  // .state('app.overview', {
  //   url: "/overview",
  //   views: {
  //     'menuContent': {
  //       templateUrl: "templates/rubyonic/overview.html"
  //     }
  //   }
  // })

  .state('app.claim-details', {
    url: "/claim-details",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/claim_details.html",
        controller: 'AppCtrl'
      }
    }
  })

  .state('app.scorecards', {
    url: "/scorecards",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/scorecards.html",
        controller: 'AppCtrl'
      }
    }
  })

  .state('app.fnol', {
    url: "/fnol",
    views: {
      'menuContent': {
        templateUrl: "templates/rubyonic/fnol.html",
        controller: 'AppCtrl'
      }
    }
  })

  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/login');
})
这是我的登录控制器:

angular.module('starter.services', [])

.factory('UserService', ['$rootScope', '$q', '$http', function($rootScope, $q, $http) {

    return {

        login: function(credentails) {
            var deffered = $q.defer();

            $http({
                method: 'post',
                url: 'http://localhost/platform/j_spring_security_check',
                params: {
                    'j_username': credentails.username,
                    'j_password': credentails.password
                }
            }).success(function(user, status, headers, config) {
                userLoggedIn = true;
                // $location.path('#/app/studies');
                localStorage.setItem('lastLoginTime', new Date().getTime());
                $rootScope.$broadcast('USER_LOGIN_SUCCESS');
                deffered.resolve(user);
            }).error(function(data, status, headers, config){
                $rootScope.$broadcast('USER_LOGIN_FAILED');
                deffered.reject(data);
            });

            return deffered.promise;
        },


        isUserLoggedIn: function() {
            return userLoggedIn;
        }

    };
}])
角度模块('starter.controllers',['highcharts-ng']))

这是我的UserService,它被注入到登录控制器中:

angular.module('starter.services', [])

.factory('UserService', ['$rootScope', '$q', '$http', function($rootScope, $q, $http) {

    return {

        login: function(credentails) {
            var deffered = $q.defer();

            $http({
                method: 'post',
                url: 'http://localhost/platform/j_spring_security_check',
                params: {
                    'j_username': credentails.username,
                    'j_password': credentails.password
                }
            }).success(function(user, status, headers, config) {
                userLoggedIn = true;
                // $location.path('#/app/studies');
                localStorage.setItem('lastLoginTime', new Date().getTime());
                $rootScope.$broadcast('USER_LOGIN_SUCCESS');
                deffered.resolve(user);
            }).error(function(data, status, headers, config){
                $rootScope.$broadcast('USER_LOGIN_FAILED');
                deffered.reject(data);
            });

            return deffered.promise;
        },


        isUserLoggedIn: function() {
            return userLoggedIn;
        }

    };
}])

当我运行我的应用程序时,我得到了:
错误:[$injector:unpr]未知提供程序:$stateProviderProviderProvider产生错误的原因是,在
LoginCtrl
中,您试图注入的提供程序是
$stateProvider
,基本上提供程序在控制器中不可用,如果它们在控制器中是
$state
而不是
$stateProvider
,则可以作为服务名称访问

controller('LoginCtrl', ['$scope','$stateProvider','UserService', 
应该是

controller('LoginCtrl', ['$scope','$state','UserService',