diff --git a/js/ext/angular/src/directive/ionicViewState.js b/js/ext/angular/src/directive/ionicViewState.js
index e7ed4657e43..ff418bd4483 100644
--- a/js/ext/angular/src/directive/ionicViewState.js
+++ b/js/ext/angular/src/directive/ionicViewState.js
@@ -95,7 +95,8 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
if(tAttrs.type) tElement.addClass(tAttrs.type);
return function link($scope, $element, $attr) {
- $scope.enableBackButton = true;
+ var canHaveBackButton = !(!tAttrs.backButtonType && !tAttrs.backButtonLabel);
+ $scope.enableBackButton = canHaveBackButton;
$rootScope.$on('viewState.showNavBar', function(e, showNavBar) {
if(showNavBar === false) {
@@ -121,7 +122,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
$scope.rightButtons = data.rightButtons;
if(typeof data.hideBackButton !== 'undefined') {
- $scope.enableBackButton = data.hideBackButton !== true;
+ $scope.enableBackButton = data.hideBackButton !== true && canHaveBackButton;
}
if(data.animate !== false && $attr.animation && data.title && data.navDirection) {
diff --git a/js/ext/angular/test/directive/ionicView.unit.js b/js/ext/angular/test/directive/ionicView.unit.js
index 6be0b3958c3..089ddde7bc7 100644
--- a/js/ext/angular/test/directive/ionicView.unit.js
+++ b/js/ext/angular/test/directive/ionicView.unit.js
@@ -83,6 +83,13 @@ describe('Ionic View', function() {
expect(element.hasClass('bar-positive')).toEqual(true);
});
+ it('should not show the back button if no back button attributes set', function() {
+ var element = compile('')(scope);
+ scope.$digest();
+ var backButton = element.find('div').find('button');
+ expect(backButton.length).toEqual(0);
+ });
+
it('should set just a back button icon, no text', function() {
var element = compile('')(scope);
scope.$digest();