Lady Rainicorn Lady Rainicorn - 1 year ago 200
AngularJS Question

Angularjs slow to load templates

I have some which doesn't really do much, still it does really take the longest time to load. I have written the code down for you all to see:


var simple = "simple test";
angular.module('CRTapp', []).controller('ItemController', function() {
this.item = simple;


<div id="item" ng-controller="ItemController as item">

Sometimes people are having to wait nearly a second to see:



simple test

appears but this is a very long time for some of you to have to wait. Waiting is ok for me but sometimes Jake gets impatient so I can make the HTML page load slowly if you like, but I do not want my Mr Stretchy to become sad when he sees a template before his own special website for his adventures in the Candy Kingdom.

Answer Source

This delay is the time angular library gets to parse your html. You can use ng-bind instead:

<div id="item" 
     ng-controller="ItemController as item"

This way, your page don't get poluted while angular loads its content.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download