user1940321
user1940321

Reputation:

Variable 'name' flashing at page load

I'm new to angular and I'm working through some tutorials, but can't seem to find out how to get a variable {{ name }} to quit flashing right before page load... Has anyone run into this problem before?

{{ name }} shows for a split second and then goes away. Just trying to get it to not show for a split second.

enter image description here

Thanks in advance!

Upvotes: 2

Views: 1584

Answers (3)

nbaosullivan
nbaosullivan

Reputation: 4144

Just following this up if it will help anyone, like kirhgoff, wondering how to sort this for the title element: ng-cloak will help to some extent, but you can fully prevent it using ng-bind directive instead of using {{ }}.

so:

<title ng-bind="pageTitle"></title>

not:

<title>{{pageTitle}}</title>

This avoids the issue ng-cloak solves entirely.

Upvotes: 2

Prabin Tp
Prabin Tp

Reputation: 766

ngCloak directive is used to avoid the undesirable flicker effect caused by the html template display.

For example:

<div id="template1" ng-cloak>{{ 'hello' }}</div>
<div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>

Upvotes: 3

Chandermani
Chandermani

Reputation: 42669

You can also use ngcloak to suppress the html templates output before the actual binding occurs.

Upvotes: 5

Related Questions