Allow nested hash objects in isolate scope option
I propose enhancing the scope option parameter for directives, to support binding to nested properties in isolate scopes:
scope: {
model: {
value: '=ngModel'
}
}
This would provide an avenue for directive implementations to set up bindings on a nested property, where they can be safely bound from child scopes of the isolate scope, e.g. ngTransclude or ngIf.
See http://stackoverflow.com/questions/26459958/how-to-reconcile-angulars-always-use-dots-with-ngmodel-rule-with-isolate-scop for context.
I was going to say that this should be an idea for Angular v2 but this form of isolated scope definition is going away in v2 so it would be handled in an entirely different way.
Just as a followup, the simplest solution I found was to just inline the directive that was using ng-transclude into the directive that invoked the former, which eliminated the extra scope, at the expense of markup duplication.
Actually, how about supporting it through:
scope: {
'model.value': '=ngModel'
}
Probably simpler to implement and consistent with Angular expression handling. Though doing the following would probably have undefined behavior:
scope: {
model: '=something',
'model.value': '=ngModel'
}
Not actually simpler --- less usable to do it that way, and also a breaking change.
Yea, it'll break users that depend on properties containing . in them, which in my opinion would be rare, but in that respect it's a breaking change.
On further thought, you're right. The OP's suggestion is better.