4 ms·
ng-cloak is your friend..
by miaumiau2 10y ago
ng-cloak is your friend..
- BinaryIdiot 10y agoI guess but it feels like such an anti pattern. I have to tag every thing that uses the template system with ng-cloak and that assumes the angular css loads before the HTML which can still not be guaranteed it's just more likely. The worst part is many default values could be displayed but now we're hiding sometimes large junks when for the best UX you should show as much of the page as possible. Ultimately just not a fan of any template engine that relies on being fast enough to hide and replace values in the raw HTML.
- really_operator 10y agoTo reduce the need for ng-cloak, use ng-bind <p ng-bind="value"></p> instead of <p>{{value}}</p> It is preferable to use ngBind instead of {{ expression }} if a template is momentarily displayed by the browser in its raw state before Angular compiles it. Since ngBind is an element attribute, it makes the bindings invisible to the user while the page is loading.
- BinaryIdiot 10y agoInteresting, I forgot about ng-bind (honestly it's a pattern I never see on the web). That is, for sure, the superior pattern.