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

ngModelController is semi-useless with scope:truthy #6199

Closed
ProLoser opened this issue Feb 10, 2014 · 2 comments
Closed

ngModelController is semi-useless with scope:truthy #6199

ProLoser opened this issue Feb 10, 2014 · 2 comments

Comments

@ProLoser
Copy link
Contributor

Since using scope:truthy on a directive creates a new scope, the ng-model attribute no longer refers to the model the user intended, but instead is now one level deeper. This creates an unexpected behavior when someone is, say, using $scope.val instead of $scope.obj.val.

I don't know of any elegant way to work around this problem other than to not leverage ngModelController (which seems like poor design). Is there perhaps any way to ensure the ngModel is evaluated on the outer scope (such as by changing directive priorities) but can be accessed/modified by directives with a deeper scope?

This issue is in response to angular-ui/ui-select#18 (pinging @tkrotoff)

@caitp
Copy link
Contributor

caitp commented Feb 10, 2014

Well, it seems like you've answered your own question here :p You really need to wrap primitives which is to be shared between scopes in objects.

I've suggested using ES6 proxy objects to get around this in the future (for transcluded scopes), but for child scopes I'm not totally sure what can be done about this. Maybe there is some pattern that could make all of this transparent, I'm not sure.

In the mean time though, I don't think this is really actionable. I'm not sure if I want to close this, but I'll see what other people think.

@caitp
Copy link
Contributor

caitp commented Feb 10, 2014

Alright, so @btford doesn't think this is particularly actionable, so basically you know what needs to be done to make this work, I think this is going to be closed as invalid

@caitp caitp closed this as completed Feb 10, 2014
@caitp caitp added this to the Backlog milestone Feb 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants