Lady Rainicorn Lady Rainicorn - 8 months ago 109
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.


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.