angular.element(ready) 函数在 cordova 中调用了两次

angular.element(ready) function called twice in cordova

以下代码的输出:

     app.controller('puntenboekjeController', function ($scope) {
             function upd(){
                console.log("test");
             }

             angular.element(document).ready(function() {
                upd();
             });
    });

是:

test
test

在index.js中,我没有bootstrapangular(或其他任何地方),app是在body-tag中定义的,我从未使用过onDeviceReady。

似乎控制器代码调用两次确实意味着您通过使用 ng-controller 或从 SPA 的 route 定义加载控制器两次。