Ajeesh Joshy
Ajeesh Joshy

Reputation: 1537

Angular loading template inline

In an angular js 1.2.22 version code, I saw this in the HTML

<div class="mainContent" ng-include="content"> </div>

and in its corresponding controller, I see this.

$scope.content = 'templates/contents/home.html';

I see its making an Ajax call to load the template.

I am working on improving the speed of the content display and I did some optimizations like minifying the javascript code and minifying css

My doubt is how to make this inline - without making the Ajax call. So, that I could check if there is visible difference in speed of the content showing up for this template?

I tried the gulp-angular-templatecache to cache templates but, it did not work. Is there any workaround for this so that I can make this template inline ?

Upvotes: 0

Views: 217

Answers (1)

xsh.7
xsh.7

Reputation: 6250

What you're looking for is Angular's $templateCache.

Depending on your task runner, you might want to give gulp-angular-templatecache or grunt-angular-templatecache a try.

Upvotes: 1

Related Questions