How to get the route name when location changes?

后端 未结 4 985
借酒劲吻你
借酒劲吻你 2020-12-05 13:35

I defined some routes:

angular.module(\'myApp\', [])
  .config(\'$routeProvider\', function($routeProvider) {
    $routeProvider.when(\'/aaa\', { templateUrl         


        
4条回答
  •  孤城傲影
    2020-12-05 14:13

    I think you can easily get the path from current

    app.run(function ($rootScope) {
        $rootScope.$on('$routeChangeSuccess', function (e, current, pre) {
            console.log(current.originalPath); // Do not use $$route here it is private
        });
    });
    

提交回复
热议问题