Optim: subscriptions managed by router

This commit is contained in:
2015-11-05 09:26:12 +00:00
parent 42e5a06750
commit 8e66b1a767
3 changed files with 12 additions and 5 deletions

3
client/loading.html Normal file
View File

@@ -0,0 +1,3 @@
<template name="loading">
<h1>Please wait...</h1>
</template>

View File

@@ -1,7 +1,3 @@
Template.management.onCreated(function(){
Meteor.subscribe('projects');
});
Template.management.helpers({
projects: function () {
return ProjectService.list();

View File

@@ -7,5 +7,13 @@ Router.map(function () {
this.route('home', {
path: '/',
});
this.route('management');
this.route('management', function() {
this.subscribe('projects').wait();
if (this.ready()) {
this.render();
} else {
this.render('Loading');
}
});
});