Heddy
Heddy

Reputation: 1

AngularJS - DOM-Elements are flickering

lately I have a pretty significant problem with ng-view and ng-if.Suppose there is a dropdown with two elements (element one and element two).The two elements change a property on rootScope.

I have two more items at another location (div-container, container one and two containers). These are displayed by ng-show - container one at element one and container at element two.

As soon as I click the one element one time and the property of the rootScope changes and then I reload the page, the two containers are alternately displayed without that I do something.

I have several watchers, seveleral ng-cloaks and use the routing using ng-view. I would also like to mention that the application is relatively large. Most often, the problem occurs on Android, presumably on iOS.

Upvotes: 0

Views: 407

Answers (1)

Roy
Roy

Reputation: 1967

As soon as I click the one element one time and the property of the rootScope changes and then I reload the page, the two containers are alternately displayed without that I do something.

Did you mean the other two containers just show up for a second and then disappear? If that is the case then I think the condition you are providing inside ng-show is true at the loading time so they appear for a while before the condition changes and then they disappear.

You have to make sure the condition for ng-show is initially false.

Upvotes: 0

Related Questions