Created
September 9, 2015 15:23
-
-
Save themeteorchef/4c146fd276e58bdd0815 to your computer and use it in GitHub Desktop.
Loading based on all subs elsewhere?
This file contains hidden or 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
| <!-- Then in your template, have a helper bound to that session variable routeLoaded... --> | |
| <template name="header"> | |
| <header> | |
| {{#if routeLoaded}} | |
| <p>header contents</p> | |
| {{else}} | |
| {{> loader}} | |
| {{/if}} | |
| </header> | |
| </template> |
This file contains hidden or 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
| Router.route( 'someRoute', { | |
| path: '/some-route', | |
| template: 'someTemplate', | |
| subscriptions: function(){ | |
| var subscriptions = [ | |
| Meteor.subscribe( 'someSub1' ), | |
| Meteor.subscribe( 'someSub2' ) | |
| ]; | |
| // This is messy but could be replaced with a loop. | |
| if ( subscriptions[0].ready() && subscriptions[1].ready() ) { | |
| Session.set( "routeLoaded", true ); | |
| } else { | |
| Session.set( "routeLoaded", false ); | |
| } | |
| return subscriptions; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment