| 21682 | </example> |
| 21683 | */ |
| 21684 | var ngModelOptionsDirective = function() { |
| 21685 | return { |
| 21686 | restrict: 'A', |
| 21687 | controller: ['$scope', '$attrs', function($scope, $attrs) { |
| 21688 | var that = this; |
| 21689 | this.$options = $scope.$eval($attrs.ngModelOptions); |
| 21690 | // Allow adding/overriding bound events |
| 21691 | if (this.$options.updateOn !== undefined) { |
| 21692 | this.$options.updateOnDefault = false; |
| 21693 | // extract "default" pseudo-event from list of events that can trigger a model update |
| 21694 | this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() { |
| 21695 | that.$options.updateOnDefault = true; |
| 21696 | return ' '; |
| 21697 | })); |
| 21698 | } else { |
| 21699 | this.$options.updateOnDefault = true; |
| 21700 | } |
| 21701 | }] |
| 21702 | }; |
| 21703 | }; |
| 21704 | |
| 21705 | // helper methods |
| 21706 | function addSetValidityMethod(context) { |