angular怎么获取前一个页面的url


想知道当前页面是由哪个页面跳过来的,应该怎么做呢?我用ui-router,把$state打印出来但是没有找到相关的内容诶

ui-router angularjs

哥,你懂得 10 years, 4 months ago

 rootScope.$on('$stateChangeSuccess', function (ev, to, toParams, from, fromParams) {
        $rootScope.previousState = from;
        $rootScope.previousParams = fromParams;
    });

kazuo answered 10 years, 4 months ago

Your Answer