diff --git a/js/ext/angular/src/directive/ionicContent.js b/js/ext/angular/src/directive/ionicContent.js index e18683cc7cb..f65e7a2d470 100644 --- a/js/ext/angular/src/directive/ionicContent.js +++ b/js/ext/angular/src/directive/ionicContent.js @@ -48,7 +48,7 @@ angular.module('ionic.ui.content', ['ionic.ui.scroll']) * with {@link ionic.service:$ionicScrollDelegate}. * @param {boolean=} padding Whether to add padding to the content. * of the content. Defaults to true on iOS, false on Android. - * @param {boolean=} scroll Whether to allow scrolling of content. Defaults to true. Note: scroll="false" removes the .scroll child element on element compilation, not on scope change + * @param {boolean=} scroll Whether to allow scrolling of content. Defaults to true. * @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of * Ionic scroll. * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges diff --git a/js/ext/angular/src/directive/ionicViewState.js b/js/ext/angular/src/directive/ionicViewState.js index 4eb907bd890..d6aa8c96f8c 100644 --- a/js/ext/angular/src/directive/ionicViewState.js +++ b/js/ext/angular/src/directive/ionicViewState.js @@ -48,15 +48,20 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu if (!navBarCtrl) { return; } - var initialTitle = $attr.title; - navBarCtrl.changeTitle(initialTitle, $scope.$navDirection); - // watch for changes in the title, don't set initial value as changeTitle does that - $attr.$observe('title', function(val, oldVal) { - if (val !== initialTitle) { - navBarCtrl.setTitle(val); - } - }); + if (angular.isDefined($attr.title)) { + + var initialTitle = $attr.title; + navBarCtrl.changeTitle(initialTitle, $scope.$navDirection); + + // watch for changes in the title, don't set initial value as changeTitle does that + $attr.$observe('title', function(val, oldVal) { + if (val !== initialTitle) { + navBarCtrl.setTitle(val); + } + }); + + } $scope.$watch($attr.hideBackButton, function(value) { // Should we hide a back button when this tab is shown diff --git a/js/ext/angular/test/directive/ionicView.unit.js b/js/ext/angular/test/directive/ionicView.unit.js index 86a32c7976c..deb34fd8d5c 100644 --- a/js/ext/angular/test/directive/ionicView.unit.js +++ b/js/ext/angular/test/directive/ionicView.unit.js @@ -33,7 +33,17 @@ describe('ionView directive', function() { expect(el.html()).toBe('some html'); }); - it('should changeTitle with a navDirection', function() { + it('should not changeTitle with undefined title attr', function() { + var el = setup(); + expect(el.controller('ionNavBar').changeTitle).not.toHaveBeenCalled(); + }); + + it('should changeTitle with blank if title attr is blank', function() { + var el = setup('title=""', {$navDirection: 'someDirection'}); + expect(el.controller('ionNavBar').changeTitle).toHaveBeenCalledWith('', 'someDirection'); + }); + + it('should changeTitle with a navDirection if title set', function() { var el = setup('title="Hi, {{1}}!"', {$navDirection: 'foo'}); expect(el.controller('ionNavBar').changeTitle).toHaveBeenCalledWith('Hi, 1!', 'foo'); });