diff --git a/js/angular/directive/content.js b/js/angular/directive/content.js index a4bd392183..ecb68f79f5 100644 --- a/js/angular/directive/content.js +++ b/js/angular/directive/content.js @@ -40,6 +40,7 @@ function($timeout, $controller, $ionicBind) { restrict: 'E', require: '^?ionNavView', scope: true, + priority: 800, compile: function(element, attr) { var innerElement; diff --git a/test/unit/angular/directive/content.unit.js b/test/unit/angular/directive/content.unit.js index 0d7b4bd202..5cb7bfd291 100644 --- a/test/unit/angular/directive/content.unit.js +++ b/test/unit/angular/directive/content.unit.js @@ -115,7 +115,7 @@ describe('Ionic Content directive', function() { }); }); -/* Tests #555 */ +/* Tests #555, #1155 */ describe('Ionic Content Directive scoping', function() { beforeEach(module('ionic', function($controllerProvider) { $controllerProvider.register('ContentTestCtrl', function($scope){ @@ -125,10 +125,16 @@ describe('Ionic Content Directive scoping', function() { it('should have same scope as content', inject(function($compile, $rootScope) { var element = $compile('' + '
' + + '' + '
')($rootScope.$new()); var contentScope = element.scope(); var ctrl = element.data('$ngControllerController'); expect(contentScope.myForm).toBeTruthy(); expect(ctrl.$scope.myForm).toBeTruthy(); + var input = angular.element(element[0].querySelector('input')); + input.val('bar'); + input.triggerHandler('input'); + expect(input.scope().foo).toBe('bar'); + expect(ctrl.$scope.foo).toBe('bar'); })); });