@@ -1659,20 +1659,20 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1659
1659
if ( $error [ validationErrorKey ] ) invalidCount -- ;
1660
1660
if ( ! invalidCount ) {
1661
1661
toggleValidCss ( true ) ;
1662
- this . $valid = true ;
1663
- this . $invalid = false ;
1662
+ ctrl . $valid = true ;
1663
+ ctrl . $invalid = false ;
1664
1664
}
1665
1665
} else {
1666
1666
toggleValidCss ( false ) ;
1667
- this . $invalid = true ;
1668
- this . $valid = false ;
1667
+ ctrl . $invalid = true ;
1668
+ ctrl . $valid = false ;
1669
1669
invalidCount ++ ;
1670
1670
}
1671
1671
1672
1672
$error [ validationErrorKey ] = ! isValid ;
1673
1673
toggleValidCss ( isValid , validationErrorKey ) ;
1674
1674
1675
- parentForm . $setValidity ( validationErrorKey , isValid , this ) ;
1675
+ parentForm . $setValidity ( validationErrorKey , isValid , ctrl ) ;
1676
1676
} ;
1677
1677
1678
1678
/**
@@ -1686,8 +1686,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1686
1686
* state (ng-pristine class).
1687
1687
*/
1688
1688
this . $setPristine = function ( ) {
1689
- this . $dirty = false ;
1690
- this . $pristine = true ;
1689
+ ctrl . $dirty = false ;
1690
+ ctrl . $pristine = true ;
1691
1691
$animate . removeClass ( $element , DIRTY_CLASS ) ;
1692
1692
$animate . addClass ( $element , PRISTINE_CLASS ) ;
1693
1693
} ;
@@ -1713,30 +1713,30 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1713
1713
*/
1714
1714
this . $cancelUpdate = function ( ) {
1715
1715
$timeout . cancel ( pendingDebounce ) ;
1716
- this . $render ( ) ;
1716
+ ctrl . $render ( ) ;
1717
1717
} ;
1718
1718
1719
1719
// update the view value
1720
1720
this . $$realSetViewValue = function ( value ) {
1721
- this . $viewValue = value ;
1721
+ ctrl . $viewValue = value ;
1722
1722
1723
1723
// change to dirty
1724
- if ( this . $pristine ) {
1725
- this . $dirty = true ;
1726
- this . $pristine = false ;
1724
+ if ( ctrl . $pristine ) {
1725
+ ctrl . $dirty = true ;
1726
+ ctrl . $pristine = false ;
1727
1727
$animate . removeClass ( $element , PRISTINE_CLASS ) ;
1728
1728
$animate . addClass ( $element , DIRTY_CLASS ) ;
1729
1729
parentForm . $setDirty ( ) ;
1730
1730
}
1731
1731
1732
- forEach ( this . $parsers , function ( fn ) {
1732
+ forEach ( ctrl . $parsers , function ( fn ) {
1733
1733
value = fn ( value ) ;
1734
1734
} ) ;
1735
1735
1736
- if ( this . $modelValue !== value ) {
1737
- this . $modelValue = value ;
1736
+ if ( ctrl . $modelValue !== value ) {
1737
+ ctrl . $modelValue = value ;
1738
1738
ngModelSet ( $scope , value ) ;
1739
- forEach ( this . $viewChangeListeners , function ( listener ) {
1739
+ forEach ( ctrl . $viewChangeListeners , function ( listener ) {
1740
1740
try {
1741
1741
listener ( ) ;
1742
1742
} catch ( e ) {
@@ -1772,17 +1772,17 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1772
1772
* @param {string } trigger Event that triggered the update.
1773
1773
*/
1774
1774
this . $setViewValue = function ( value , trigger ) {
1775
- var debounceDelay = this . $options && ( isObject ( this . $options . debounce )
1776
- ? ( this . $options . debounce [ trigger ] || this . $options . debounce [ 'default' ] || 0 )
1777
- : this . $options . debounce ) || 0 ;
1775
+ var debounceDelay = ctrl . $options && ( isObject ( ctrl . $options . debounce )
1776
+ ? ( ctrl . $options . debounce [ trigger ] || ctrl . $options . debounce [ 'default' ] || 0 )
1777
+ : ctrl . $options . debounce ) || 0 ;
1778
1778
1779
1779
$timeout . cancel ( pendingDebounce ) ;
1780
1780
if ( debounceDelay ) {
1781
1781
pendingDebounce = $timeout ( function ( ) {
1782
1782
ctrl . $$realSetViewValue ( value ) ;
1783
1783
} , debounceDelay ) ;
1784
1784
} else {
1785
- this . $$realSetViewValue ( value ) ;
1785
+ ctrl . $$realSetViewValue ( value ) ;
1786
1786
}
1787
1787
} ;
1788
1788
0 commit comments