Created
September 1, 2014 02:38
-
-
Save zefei/4ea6eeed89cf3a3dfb18 to your computer and use it in GitHub Desktop.
Using Angular and Meteor together: templates (post Meteor 0.8)
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
// 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