Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Angular 1.x module that takes advantage of JST for templating
angular
.module('angularJst', [])
.config([
'$provide',
function($provide) {
$provide.decorator('$templateCache', function($delegate, $sniffer) {
var originalGet = $delegate.get;
$delegate.get = function(key) {
var value;
value = originalGet(key);
if (!value) {
// JST is where my partials and other templates are stored
// If not already found in the cache, look there...
value = JST[key]();
if (value) {
$delegate.put(key, value);
}
}
return value;
};
return $delegate;
});
return this;
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.