Angularjs 如何在meanjs控制器中访问$route

Angularjs 如何在meanjs控制器中访问$route,angularjs,angular-ui-router,angularjs-routing,meanjs,ngroute,Angularjs,Angular Ui Router,Angularjs Routing,Meanjs,Ngroute,我正在尝试访问当前路线,因为我在上面添加了标题 所以路线看起来像 state('reports', { title: 'Reports', url: '/reports', templateUrl: 'modules/feeditems/views/reports.client.view.html' }). 我想获得标题。所以我可以把它放在我的页眉上。所以在头球控制器中,我想我可以把它从我的头上拿下来 angular.module('core').controller(

我正在尝试访问当前路线,因为我在上面添加了标题

所以路线看起来像

state('reports', {
    title: 'Reports',
    url: '/reports',
    templateUrl: 'modules/feeditems/views/reports.client.view.html'
}).
我想获得标题。所以我可以把它放在我的页眉上。所以在头球控制器中,我想我可以把它从我的头上拿下来

angular.module('core').controller('HeaderController', ['$rootScope', '$route', '$scope', 'Authentication', 'Menus',     
function($rootScope, $route, $scope, Authentication, Menus) {
        $scope.authentication = Authentication;         
        $scope.isCollapsed = false;
        $scope.menu = Menus.getMenu('topbar');
        $scope.$route = $route;
        console.log ('typeof($route) = ' + typeof($route));
        console.log ('typeof($route.current) = ' + typeof($route.current));
我得到以下错误


错误:[$injector:unpr]未知提供程序:$routeProvider我想您可能会感到困惑,MeanJS标准配置使用Angular UI路由器

用于角度用户界面路由器 你需要
angular ui router.js
然后将
ui.router
包含在你的应用程序依赖项中

之后,在配置中使用
$stateProvider

语法

app.config(function($stateProvider){

    $stateProvider.state('reports', {
        url: '/reports',
        templateUrl: 'modules/feeditems/views/reports.client.view.html'
    })

})
如需动态添加标题,请参阅 . 这有解决你问题的办法

检查加载角度文件的顺序。 顺序必须是:

angular.js 
angular-route.js 
finally your angular scripts

您使用的是
ui路由器
还是
ngRoute
?您的路由定义显示您正在使用
state
,这将是
ui路由器
,但其他一切看起来都像是您在请求有关
ngRoute
@Tom ui路由器的帮助。这是我的第一个问题。我以为我用的是ngRoute,但实际上是ui路由器。但我似乎仍然无法获得标题。所以看起来我使用的是Angular UI路由器。那我怎么才能把标题拿出来呢?
angular.js 
angular-route.js 
finally your angular scripts