Have a a reactive var that is loaded data from Meteor.method. I have two routes, one that is ‘home’ and another that shows some other data. How can I make it such that when I come back to my home route that when I reload my home template that it loads with my previous data still in my reactive var ?
2 things
1- this code does not help much
2- you want when users refresh the page to continue with the variable value or to remain as the user moves between paths?
getPackages: function() {
return PackageData.get();
}
});```
```<template name="layout">
<nav class="nav navbar">
<div class="navbar-header">
<h2 class="navbar-title navbar-left">meta-data search</h2>
</div>
<div class="navbar-form navbar-right" role="search">
{{>searchBox}}
</div>
</div>
</nav>
{{> Template.dynamic template=main}}
</template>```
```<template name="home">
<div class="container sbox">
{{> searchResult}}
</div>
</template>```
```<template name="home2">
<div class="container">
{{> table}}
</div>
</template>```
```<template name="searchBox">
<div class="sbox">
<input type="text" id="search-box" placeholder="search tables here" />
</div>
</template>```
```<template name="searchResult">
<div class="row" id='search-result'>
{{#with getPackages}}
<div id="search-meta">
Result Count: {{metadata.total}} in ({{metadata.took}} mseconds)
</div>
<div class="header">
<h5>Tables:</h5>
</div>
{{#each data}}
<div class="package">
<div class="tname">
<h5><a href="{{pathFor 'table' tname=tname tid=id}}">{{tname}}</a></h5>
</div>
<div class="comment"><b>Comments: </b>{{tcomment}}</div>
</div>
{{/each}}
{{/with}}
</div>
</template>```
Search box is a input form. Results from the query are put in PackageData.. When I search the I get my results I can move to my second route, but when I come back to home I see no results populated from PackageData.