admin管理员组文章数量:1332389
I am making an application with angular js. I am binding content in the page using {{ data.content }} method, this works fine, but while loading the web page browser shows the same code in the page.
see the screenshot I've taken while page loading
click here
is there any way to clear this without using ng-bind method ?
EDIT
I have tried this method
1 -added ng-clock for body
<body ng-app="MyApp" ng-cloack ng-controller="MyController" >
2 -added css style for ng-clock
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
but still the same problem persists.
and I'm using latest version of both chorme and mozilla firefox
I am making an application with angular js. I am binding content in the page using {{ data.content }} method, this works fine, but while loading the web page browser shows the same code in the page.
see the screenshot I've taken while page loading
click here
is there any way to clear this without using ng-bind method ?
EDIT
I have tried this method
1 -added ng-clock for body
<body ng-app="MyApp" ng-cloack ng-controller="MyController" >
2 -added css style for ng-clock
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
but still the same problem persists.
and I'm using latest version of both chorme and mozilla firefox
Share Improve this question edited Jan 28, 2015 at 4:05 droidev asked Jan 28, 2015 at 3:24 droidevdroidev 7,39011 gold badges64 silver badges98 bronze badges 3- So it's not that it is flashing the unpiled page then ... It's more the page doesn't work? Any errors in the console? – Matt Tester Commented Jan 28, 2015 at 4:12
- 2 ng-cloack ? ng-cloak – PSL Commented Jan 28, 2015 at 4:13
- 1 @PSL oohhh... I'll edit and check – droidev Commented Jan 28, 2015 at 4:16
2 Answers
Reset to default 8I believe the issue is the delay in angular piling the page when it first downloads. Take a look at ngCloak
- https://docs.angularjs/api/ng/directive/ngCloak.
The
ngCloak
directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (unpiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display.
So, add this to your CSS file:
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
And in your html:
<body ng-cloak>
Note, for legacy browser 'support' (e.g. IE7), it would need to be:
<body ng-cloak class="ng-cloak">
Add below code, ngCloak prevent template being displayed while loading.
<style>
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
</style>
and then call this class in body tag:
<body ng-cloak class="ng-cloak">
https://docs.angularjs/api/ng/directive/ngCloak
本文标签: javascriptAngularJS Shows its own tags while page loadsStack Overflow
版权声明:本文标题:javascript - AngularJS Shows its own tags while page loads - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742287860a2447254.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论