diff --git a/js/angular/directive/modal.js b/js/angular/directive/modal.js index 5915f692019..6eb92b525cd 100644 --- a/js/angular/directive/modal.js +++ b/js/angular/directive/modal.js @@ -8,6 +8,7 @@ IonicModule restrict: 'E', transclude: true, replace: true, + controller: [function(){}], template: '' diff --git a/js/angular/directive/view.js b/js/angular/directive/view.js index 1f2f8ae0d58..b0fd77bc475 100644 --- a/js/angular/directive/view.js +++ b/js/angular/directive/view.js @@ -35,13 +35,17 @@ IonicModule return { restrict: 'EA', priority: 1000, - require: '^?ionNavBar', + require: ['^?ionNavBar', '^?ionModal'], compile: function(tElement, tAttrs, transclude) { tElement.addClass('pane'); tElement[0].removeAttribute('title'); - return function link($scope, $element, $attr, navBarCtrl) { - if (!navBarCtrl) { + return function link($scope, $element, $attr, ctrls) { + var navBarCtrl = ctrls[0]; + var modalCtrl = ctrls[1]; + + //Don't use the ionView if we're inside a modal or there's no navbar + if (!navBarCtrl || modalCtrl) { return; } diff --git a/test/unit/angular/directive/view.unit.js b/test/unit/angular/directive/view.unit.js index ba5228fb035..b9955046791 100644 --- a/test/unit/angular/directive/view.unit.js +++ b/test/unit/angular/directive/view.unit.js @@ -21,13 +21,21 @@ describe('ionView directive', function() { return el; } - it('should remove title & add pane, even with no navbar', inject(function($compile, $rootScope) { + it('should only remove title & add pane with no navbar', inject(function($compile, $rootScope) { var el = $compile('')($rootScope.$new()); $rootScope.$apply(); expect(el.hasClass('pane')).toBe(true); expect(el[0].getAttribute('title')).toBe(null); })); + it('should only remove title & add pane in a modal',inject(function($compile, $rootScope) { + var el = $compile('')($rootScope.$new()); + var view = jqLite(el[0].querySelector('.pane')); + $rootScope.$apply(); + expect(view.hasClass('pane')).toBe(true); + expect(view[0].getAttribute('title')).toBe(null); + })); + it('should have content inside', function() { var el = setup(null, null, 'some html'); expect(el.html()).toBe('some html');