You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
feat(ngModelOptions): add getterSetterContext to specify context for getter/setter bindings
Along with getterSetter, allow users to provide an expression via the getterSetterContext option.
This expression is evaluated to determine the context that should be used when invoking the ngModel
as a getter/setter function.
For example, <input ng-model="someObject.value" ng-model-options="{ getterSetter: true }"> would
previously invoke 'someObject.value()' from the global context. Now, users can specify context, like
ng-model-options="{ getterSetter: true, getterSetterContext: 'someObject'}", which would invoke
'someObject.value()' using 'someObject' as the calling context.
If getterSetterContext is not provided, fallback to using the current scope as the context.
Closes#9394
BREAKING CHANGE: previously, getter/setter functions would always be called from the global context.
This behaviour was unexpected by some users, as described in #9394, and is not particularly nice
anyways. Applications that relied on this behaviour can use `$window` instead of `this` to access
the global object... but they probably shouldn't be storing global state anyways!
}).toThrowMinErr("$parse","syntax","Syntax Error: Token 'error' is an unexpected token at column 7 of the expression [throw error] starting at [error].");
2053
+
});
2054
+
1978
2055
it('should assign invalid values to the scope if allowInvalid is true',function(){
0 commit comments