Reputation: 84
Since my variables are not reactive and there are probably over 500 variables in my script, there is not feasable way I can make everything reactive right now.
So my question is, is there any way to make Iron Router refresh the current route/template when prompted? Right now, the only way I accomplish this is using document.location.reload(true);
, but that is an ugly looking and very slow process.
Let's also say that I have a {{> yield}}
element in my template: is there any way to just refresh that part without refreshing the entire page?
Upvotes: 1
Views: 78
Reputation: 9935
You probably need to define a reactive variable (Session
or ReactiveVar
) and change the state of that variable. On your template, make an if
wrapping the part you need to refresh. When you change the state, the part inside the if
will be refreshed.
helpers:
h_checkToRefresh: function() {
if (Session.get('count') > 0) return true;
else return false;
}
template
{{#if h_checkToRefresh}}
{{>yield}}
{{/if}}
Upvotes: 1