AngularJS $ location对象没有path()函数

时间:2014-01-10 11:18:12

标签: angularjs angularjs-routing

由于某种原因,我的$ location对象在我的控制器中调用时没有路径功能。

enter image description here

有人有想法吗?

E:这里是控制器

erpmApp.controller('dashboardCtrl', ['$scope', '$http', '$parse','$swipe', '$location', '$rootScope', 'Page', 'Data', 'Config', function ($scope, $rootScope, $http, $parse, $swipe, $location, Page, Data, Config) {

    Config.setHeadbarStatus(true);

    Page.setTitle('ERP-Mobile');

    $scope.dashboarddata = null;

    $scope.redirect = function(url) {
        console.log($location);
    };

    $scope.loadDashboard = function() {
        if($scope.dashboarddata == null) {
            Data.getDashboardMenuData().then(function(response){
                $scope.dashboarddata = response;
            }); 
        }
    };
}]);

1 个答案:

答案 0 :(得分:0)

您的依赖项名称已混淆

['$scope', '$http',    '$parse','$swipe', '$location', '$rootScope', 'Page', 'Data', 'Config', function(
  $scope,   $rootScope, $http,   $parse,   $swipe,      $location,    Page,   Data, Config) {

这意味着,您认为$location实际上是'$rootScope'