ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

ng-show/ng-hide is not working on page load with ocLazyLoad #400

Open tahir-nawaz opened 7 years ago

tahir-nawaz commented 7 years ago

I am loading a state with ocLazyLoad. The controller of that state has this code in the start. $scope.test = {show: false}; and in html view I have this <button class="btn" ng-show="test.show">Hey There</button> Now when my view is loaded the button is not hidden. if I log {{test.show"}} it shows false. But this is not applying to button.

I tried something like this to execute controller when view is loaded

 $scope.$watch('$viewContentLoaded',
            function() {
                $timeout(function() {
                },0);
            });

but nothing is working.

while ng-show/ng-hide is not working ng-if works perfectly. I am not able to understand why ng-show doesn't work and ng-if works. I need to use ng-show/ng-hide

jeevasusej commented 7 years ago

This is not from the oclazyload plugin. This is like how you structure the application. Please use the pluker to reproduce the issue.

If there is view and proper controller (which is loaded by the oclazyload), then $scope will be available in the view.