diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index ff5ec4a194fc..6bc87b0e7899 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1973,22 +1973,24 @@ var ngModelDirective = function() { return { require: ['ngModel', '^?form', '^?ngModelOptions'], controller: NgModelController, - link: function(scope, element, attr, ctrls) { - // notify others, especially parent forms + link: { + pre: function(scope, element, attr, ctrls) { + // Pass the ng-model-options to the ng-model controller + if (ctrls[2]) { + ctrls[0].$options = ctrls[2].$options; + } - var modelCtrl = ctrls[0], - formCtrl = ctrls[1] || nullFormCtrl; + // notify others, especially parent forms - formCtrl.$addControl(modelCtrl); + var modelCtrl = ctrls[0], + formCtrl = ctrls[1] || nullFormCtrl; - // Pass the ng-model-options to the ng-model controller - if ( ctrls[2] ) { - modelCtrl.$options = ctrls[2].$options; - } + formCtrl.$addControl(modelCtrl); - scope.$on('$destroy', function() { - formCtrl.$removeControl(modelCtrl); - }); + scope.$on('$destroy', function() { + formCtrl.$removeControl(modelCtrl); + }); + } } }; }; diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index a87d3cc51261..43e99f0c6e63 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -642,6 +642,17 @@ describe('input', function() { expect(scope.name).toEqual('a'); }); + it('should allow overriding the model update trigger event on text areas', function() { + compileInput( + '