Last active
August 29, 2015 14:09
-
-
Save mwadams/fc1837812817526ba854 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config(["$provide", function ($provide) { | |
$provide.decorator("$templateCache", ["$delegate", "templateRepository", function ($delegate, templateRepository) { | |
// Stash away the original get method | |
var origGetMethod = $delegate.get; | |
// Replace it with our getter | |
$delegate.get = function (url) { | |
// Do we match our content type family prefix? | |
var prefix = 'application/vnd.endjin.test'; | |
if (url.slice(0, prefix.length) == prefix) { | |
return templateRepository.getTemplate(url); | |
} | |
// Otherwise, use the original get method | |
return origGetMethod(url); | |
}; | |
return $delegate; | |
}]); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment