Is there a way to prevent flicker for templates that contain concatenated values such as {{person.LastName+ ", " + person.FirstName}}
?
I don't want to see the "," until $scope.person
is bound.
Is this something that I might put into a filter? Would you create a filter for something this trivial?
You can use the ngCloak directive for that. From the docs:
The ngCloak directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display.
You can simply use ng-show
for this.
I've created a demo to show the results.
http://plnkr.co/edit/ZAC8RzagPYmLHgXcPazW?p=preview
I'm using a timeout of 2 seconds in the controller so you can see the flicker if you remove ng-show.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With