The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

$templateCache

$templateCache

3:07
An alternative to inject an AngularJS template by using $templateCache, using .get() and .put() methods
Watch this lesson now
Avatar
egghead.io

An alternative to inject an AngularJS template by using $templateCache, using .get() and .put() methods

Avatar
Karen

I wonder why we can't get the template in the app.run section, when, for example, we load a template within a ng-template script in the main html file?

Avatar
John

'<script type="text/ng-template">...' is a directive (https://docs.angularjs.org/api/ng/directive/script) and app.run executes before directives.

In reply to Karen
Avatar
William

What influences you to use $templateCache? At what point when you're building out an application that you make the decision to start using this service?

thanks,
William.

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?