Angular $routeParams is blank

后端 未结 7 1016
不知归路
不知归路 2021-02-19 03:49

I have a really simple Angular app that I\'ve distilled to the following:

var napp = angular.module(\'Napp\',[\'ngResource\']);

var CompanyCtrl = function($scop         


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-19 04:08

    Of course it will be blank. RouteParams is loaded asynchronously so you need to wait for it to get the params. Put this in your controller:

    $scope.$on('$routeChangeSuccess', function() {
       console.log($routeParams); 
    });
    

提交回复
热议问题