Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngModelOptions does not recognise dynamically generated accessors #8704

Closed
vicary opened this issue Aug 21, 2014 · 2 comments
Closed

ngModelOptions does not recognise dynamically generated accessors #8704

vicary opened this issue Aug 21, 2014 · 2 comments

Comments

@vicary
Copy link

vicary commented Aug 21, 2014

Consider this scenario.

$scope.accessor = function(object, property) {
  return function(value) {
    if ( angular.isDefined(value) ) {
      object[property] = value;
    }
    else {
      return object[property];
    }
  }
};
<input type="text" ng-model="accessor(user, 'name')" ng-model-options="{ getterSetter: true }" />

It throws the nonassign exception:

Expression 'accessor(user, 'name')' is non-assignable.

Is this a designed feature? Is so, is there a way I can bind to dynamic scope paths?

@shahata
Copy link
Contributor

shahata commented Aug 22, 2014

Yes, this constraint should indeed be relaxed in case getterSetter is used

@vicary
Copy link
Author

vicary commented Aug 22, 2014

Thanks for the prompt reply, hope it will be merged soon!

@btford btford added this to the 1.3.0 milestone Aug 25, 2014
@btford btford self-assigned this Aug 25, 2014
@btford btford closed this as completed in ab878a6 Aug 28, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants