mirror of
https://github.com/donl/meteor-ionic.git
synced 2026-06-03 06:12:24 -06:00
Ensure Router.routes[this.path] is not undefined
This commit is contained in:
parent
4a88185523
commit
aefb6885a2
1 changed files with 3 additions and 4 deletions
|
|
@ -29,11 +29,9 @@ Template.ionTab.events({
|
|||
Template.ionTab.helpers({
|
||||
classes: function () {
|
||||
var classes = ['tab-item'];
|
||||
|
||||
if (this.class) {
|
||||
classes.push(this.class);
|
||||
}
|
||||
|
||||
return classes.join(' ');
|
||||
},
|
||||
|
||||
|
|
@ -42,7 +40,7 @@ Template.ionTab.helpers({
|
|||
return this.href;
|
||||
}
|
||||
|
||||
if (this.path) {
|
||||
if (this.path && Router.routes[this.path]) {
|
||||
return Router.routes[this.path].path(Template.parentData(1));
|
||||
}
|
||||
},
|
||||
|
|
@ -57,7 +55,8 @@ Template.ionTab.helpers({
|
|||
// The initial case where there is no localStorage value and
|
||||
// no session variable has been set, this attempts to set the correct tab
|
||||
// to active based on the router
|
||||
if(Router.routes[this.path].path(Template.parentData(1)) === ionTabCurrent){
|
||||
var route = Router.routes[this.path]
|
||||
if(route && route.path(Template.parentData(1)) === ionTabCurrent){
|
||||
return 'active';
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue