$routeParams is empty in main controller

后端 未结 6 869
北海茫月
北海茫月 2020-12-15 04:41

I have this piece of layout html:


  
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 05:24

    As an alternate to the $timeout that plong0 mentioned...

    You can also inject the $route service which will show your params immediately.

    angular.module('MyModule')
      .controller('MainCtrl', function ($scope, $route) {
          console.log('routeParams:'+JSON.stringify($route.current.params));
      });
    

提交回复
热议问题