This applies to the MEAN.js. I have if-statements in my Angular view to check if I have any results from my database. If there are results, I show them, if not, then I will show an error message.
I have a problem with Angular blinking: when the page loads, for a second or seconds I see an error message and then immediately displays the results from my database. The ng-cloak directive does not work.
Code
Below I have included very simple Angular code that should clearly indicate what I am doing.
Controller:
View:
<div ng-if="personCtrl.person.length"> </div> <div ng-if="!personCtrl.person.length" ng-cloak> <p>Sorry, person could not be found.</p> </div>
I tried adding the ng-cloak directive, which does not work. MEAN.js also uses Bootstrap and provides several CSS classes, but no matter which one I add, none of them work:
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }
In short: I can add the ng-cloak directive and the ng-cloak CSS class, but they do not work. I can add style="display:none;" but this hides the error message even if it should be displayed.
source share