Angular $routeParams is blank

后端 未结 7 1010
不知归路
不知归路 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:28

    Could it be that your templateUrl points to an invalid template?

    When you change the templateUrl to an unexisting file, you will notice that the $routeParams will no longer be populated (because AngularJS detects an error when resolving the template).

    I have created a working plnkr with your code for your convenience that you can just copy and paste to get your application working:

    http://plnkr.co/edit/Yabp4c9zmDGQsUOa2epZ?p=preview

    As soon as you click the link in the example, you will see the router in action.

    Hope that helps!

提交回复
热议问题