Skip to content

Commit

Permalink
fix(ionView): only $watch attributes if defined
Browse files Browse the repository at this point in the history
Closes #1216
  • Loading branch information
ajoslin committed Apr 29, 2014
1 parent 61bab02 commit 12e5f6c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions js/angular/directive/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,19 @@ IonicModule

}

$scope.$watch($attr.hideBackButton, function(value) {
// Should we hide a back button when this tab is shown
navBarCtrl.showBackButton(!value);
});
if (angular.isDefined($attr.hideBackButton)) {
$scope.$watch($attr.hideBackButton, function(value) {
// Should we hide a back button when this tab is shown
navBarCtrl.showBackButton(!value);
});
}

$scope.$watch($attr.hideNavBar, function(value) {
// Should the nav bar be hidden for this view or not?
navBarCtrl.showBar(!value);
});
if (angular.isDefined($attr.hideNavBar)) {
$scope.$watch($attr.hideNavBar, function(value) {
// Should the nav bar be hidden for this view or not?
navBarCtrl.showBar(!value);
});
}

};
}
Expand Down

0 comments on commit 12e5f6c

Please sign in to comment.