Skip to content

Instantly share code, notes, and snippets.

@zefei
Created September 1, 2014 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zefei/4ea6eeed89cf3a3dfb18 to your computer and use it in GitHub Desktop.
Save zefei/4ea6eeed89cf3a3dfb18 to your computer and use it in GitHub Desktop.
Using Angular and Meteor together: templates (post Meteor 0.8)
// for Meteor >= 0.8.0
// load Template.* into $templateCache
angular.module('myApp')
.run(['$templateCache', function($templateCache) {
angular.forEach(Template, function(template, name) {
// Meteor uses Template to store its own templates, too
// Your template file shouldn't start with _ to avoid conflict
if (name[0] !== '_' && name !== 'prototype') {
var node = document.createElement('div');
UI.insert(UI.render(template), node);
$templateCache.put(name, node.innerHTML);
}
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment