Closed ansonphong closed 10 years ago
Here is what you need to do:
Once call pw_get_templates
postworld.run(function($rootScope, $templateCache, pwData) {
// TODO move getting templates to app startup
pwData.pw_get_templates(null).then(function(value) {
// resolve pwData.templates
pwData.templates.resolve(value.data);
pwData.templatesFinal = value.data;
console.log('postworld RUN getTemplates=',pwData.templatesFinal);
});
// TODO remove in production
$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
});
});
Then, in any controller, call this for example, like in pwLoadPostController or pwFeedController:-
pwData.templates.promise.then(function(value) {
$scope.templateUrl = pwData.pw_get_template('posts','post','full');
});
It is stored in pwData, but you use it with pw_get_template. for your specific example you do this:-
pwData.pw_get_template('panels','','media_modal');
let me know.
Great thanks that totally makes sense. Perfect. I'll let you know of any further questions.
On 2013-11-03, at 3:09 AM, michelhabib notifications@github.com wrote:
Here is what you need to do:
Once call pw_get_templates
postworld.run(function($rootScope, $templateCache, pwData) {
// TODO move getting templates to app startup pwData.pw_get_templates(null).then(function(value) { // resolve pwData.templates pwData.templates.resolve(value.data); pwData.templatesFinal = value.data; console.log('postworld RUN getTemplates=',pwData.templatesFinal); });
// TODO remove in production $rootScope.$on('$viewContentLoaded', function() { $templateCache.removeAll(); }); }); Then, in any controller, call this for example, like in pwLoadPostController or pwFeedController:-pwData.templates.promise.then(function(value) { $scope.templateUrl = pwData.pw_get_template('posts','post','full'); });
It is stored in pwData, but you use it with pw_get_template. for your specific example you do this:-
pwData.pw_get_template('panels','','media_modal');
let me know.— Reply to this email directly or view it on GitHub.
Hi Michel, I have a quick question.
How do I access the URLs from the
pw_get_templates
action? For instance, the template URL I want is intemplates.panels.media_modal
, but how do access that from a controller?? Is it stored inwindow
or$rootScope
?