Angularjs: Controller is called multiple times

后端 未结 4 1320
我寻月下人不归
我寻月下人不归 2021-01-12 13:59

For some reason, my controller is double called, when I switch between resource 1 and resource2.

Here\'s the code:

index.html



        
4条回答
  •  执笔经年
    2021-01-12 14:23

    Found an exact same question:

    AngularJs: controller is called twice by using $routeProvider

    The solution is to add "/" at the end of router url:

    -      when('/res/:id',
    +      when('/res/:id/',
    

提交回复
热议问题