angular.js - When $rootScope is called in the scope of ngView, it often cannot be called because the root scope is slow to load.
阿神
阿神 2017-05-15 16:54:06
0
1
634

Now the program can run, but sometimes it needs to be refreshed several times to get it right. If you are unlucky, it will appear when loading

TypeError: $rootScope.gotoPGoals is not a function

and other error messages. It is speculated that there is a competition between the loading speed of the root scope and the current scope. If the root scope cannot catch up with the loading completion, the call will fail.
Wondering how to fix this problem?


Cannot be written in app.run(), because functions such as $scope.gotoPGoals() are defined in the controller of the directive and operate the $element of the directive.
Because the directive and the superior (that is, ngView) share the same scope, it is called with $rootScope...

阿神
阿神

闭关修行中......

reply all(1)
仅有的幸福

Why not write rootScope into run?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template