Reputation: 3497
I want to share cached template strings between different js libs and need to call $templateCache.get("TEMPLATE.HTML")
for an Angular app.
The Angular app is available in public JavaScript scope.
Can anyone point me to the right direction please?
Upvotes: 2
Views: 567
Reputation: 193261
You can access any service via $injector
service:
var $templateCache = angular.element(document.documentElement).injector().get('$templateCache');
var html = $templateCache.get("TEMPLATE.HTML");
Note: angular.element
should be provided with element on which angular app is registered. In above example it's html
tag, and document.documentElement
points to HTML node.
Upvotes: 3