I have just used ng’s routing. In fact, in the routing configuration, we configured a controller for different templates. At this time, we no longer need to write it in the template
I defined the controller once in $stateProvider, and then defined it again in html using ng-controller and controller as, and encountered the same situation. This can be solved by using controllerAs directly in $stateProvider.
Have your problem been solved? I also encountered this problem. I have only defined the controller in $stateProvider. I only need to switch it a few times and execute it several times. Each time it corresponds to a different $scope
Excuse me, if I don’t add ng-controller to my page, or should I use ng-click to execute it twice, it will jump twice? If I use ng-click, it will jump once
A rough estimate is that you added ng-controller="controller you defined" to your html code
I have just used ng’s routing. In fact, in the routing configuration, we configured a controller for different templates. At this time, we no longer need to write it in the template
Looking at your html code, I guess you initialized the control twice somewhere.
Has the poster found the cause of this problem now? I have also encountered it. Please give me some advice.
<p class="dv_contain" ng-controller="controller"> This happened many times
I defined the controller once in $stateProvider, and then defined it again in html using ng-controller and controller as, and encountered the same situation. This can be solved by using controllerAs directly in $stateProvider.
Have your problem been solved? I also encountered this problem. I have only defined the controller in $stateProvider. I only need to switch it a few times and execute it several times. Each time it corresponds to a different $scope
Excuse me, if I don’t add ng-controller to my page, or should I use ng-click to execute it twice, it will jump twice? If I use ng-click, it will jump once
ng-view is written twice, just remove one and it will be fine