AngularJs: controller is called twice by using $routeProvider

前端 未结 10 2211
慢半拍i
慢半拍i 2020-12-04 14:43

Module routes:

var switchModule = angular.module(\'switchModule\', []);

switchModule.config([\'$routeProvider\', function($routeProvider) {
    $routeProvid         


        
10条回答
  •  一生所求
    2020-12-04 15:11

    I had same problem and found that if you bootstrapped you angular two time you can have same error.

    In my case I had but also angular.bootstrap(document,['app']) and that caused double initialization of controllers.

    Hope this can save some time to someone.

提交回复
热议问题