Created
June 19, 2014 23:12
-
-
Save benmj/9c8670f4819f647ae3b0 to your computer and use it in GitHub Desktop.
This file contains 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
function getTemplateAsync (templateName) { | |
var dfd = $q.defer(); | |
var template = $templateCache.get(templateName); | |
if (!template) { | |
$http.get(templateName).success(function (data) { | |
$templateCache.put(templateName); | |
dfd.resolve(data); | |
}); | |
} else { | |
$timeout(function () { | |
dfd.resolve(template); | |
}); | |
} | |
return dfd.promise; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment