diff options
| author | Misko Hevery | 2011-11-01 21:09:54 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2011-11-14 16:39:32 -0800 | 
| commit | ed36b9da3be338fe9eb36f3eeea901d6f51cd768 (patch) | |
| tree | ffdc924e4b1fc1c6912674c82e029bf975ca9fca /src/widget | |
| parent | c925f8a6578e05c8136c206f2fd98eeaaf1c0f16 (diff) | |
| download | angular.js-ed36b9da3be338fe9eb36f3eeea901d6f51cd768.tar.bz2 | |
refactor(injector): switch to injector 2.0 introduce modules
Diffstat (limited to 'src/widget')
| -rw-r--r-- | src/widget/form.js | 4 | ||||
| -rw-r--r-- | src/widget/input.js | 14 | ||||
| -rw-r--r-- | src/widget/select.js | 4 | 
3 files changed, 12 insertions, 10 deletions
diff --git a/src/widget/form.js b/src/widget/form.js index 065ee74d..4608efc1 100644 --- a/src/widget/form.js +++ b/src/widget/form.js @@ -56,7 +56,7 @@  angularWidget('form', function(form){    this.descend(true);    this.directives(true); -  return annotate('$formFactory', function($formFactory, formElement) { +  return ['$formFactory', '$element', function($formFactory, formElement) {      var name = formElement.attr('name'),          parentForm = $formFactory.forElement(formElement),          form = $formFactory(parentForm); @@ -74,7 +74,7 @@ angularWidget('form', function(form){          formElement[value ? 'addClass' : 'removeClass']('ng-' + name);        });      } -  }); +  }];  });  angularWidget('ng:form', angularWidget('form')); diff --git a/src/widget/input.js b/src/widget/input.js index cf29d0f1..5108a4e4 100644 --- a/src/widget/input.js +++ b/src/widget/input.js @@ -569,7 +569,7 @@ angularInputType('radio', function(inputElement) {  function numericRegexpInputType(regexp, error) { -  return function(inputElement) { +  return ['$element', function(inputElement) {      var widget = this,          min = 1 * (inputElement.attr('min') || Number.MIN_VALUE),          max = 1 * (inputElement.attr('max') || Number.MAX_VALUE); @@ -598,7 +598,7 @@ function numericRegexpInputType(regexp, error) {          widget.$viewValue = '' + widget.$modelValue;        }      }; -  }; +  }];  } @@ -713,7 +713,7 @@ angularWidget('input', function(inputElement){    this.descend(true);    var modelExp = inputElement.attr('ng:model');    return modelExp && -    annotate('$defer', '$formFactory', function($defer, $formFactory, inputElement){ +    ['$defer', '$formFactory', '$element', function($defer, $formFactory, inputElement){        var form = $formFactory.forElement(inputElement),            // We have to use .getAttribute, since jQuery tries to be smart and use the            // type property. Trouble is some browser change unknown to text. @@ -761,14 +761,16 @@ angularWidget('input', function(inputElement){          }        } -      !TypeController.$inject && (TypeController.$inject = []); +      //TODO(misko): setting $inject is a hack +      !TypeController.$inject && (TypeController.$inject = ['$element']);        widget = form.$createWidget({            scope: modelScope,            model: modelExp,            onChange: inputElement.attr('ng:change'),            alias: inputElement.attr('name'),            controller: TypeController, -          controllerArgs: [inputElement]}); +          controllerArgs: {$element: inputElement} +      });        watchElementProperty(this, widget, 'value', inputElement);        watchElementProperty(this, widget, 'required', inputElement); @@ -830,7 +832,7 @@ angularWidget('input', function(inputElement){            }          });        } -    }); +    }];  }); diff --git a/src/widget/select.js b/src/widget/select.js index 2e328b26..c70b5ded 100644 --- a/src/widget/select.js +++ b/src/widget/select.js @@ -131,7 +131,7 @@ angularWidget('select', function(element){    this.directives(true);    this.descend(true);    return element.attr('ng:model') && -      annotate('$formFactory', '$compile', function($formFactory, $compile, selectElement){ +      ['$formFactory', '$compile', '$element', function($formFactory, $compile, selectElement){      var modelScope = this,          match,          form = $formFactory.forElement(selectElement), @@ -433,5 +433,5 @@ angularWidget('select', function(element){          }        };      } -  }); +  }];  });  | 
