This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
bindToController with object hash allows binding properties with new instead of isolate scope #13658
Milestone
Comments
-1 It should not use scope:{} in all cases. For example: <my-component-foo data-foo="foo" my-decorator-bar data-bar="bar">
... Which in both directives you can have bindToController: if decorators have scope:true can coexist with components with scope:{}. If you force to have always scope:{} you are actually forbidding to use bindToController in attribute directives. |
I completely agree with @drpicox. |
I see what you mean. Well, we need better docs for this, then. |
I too think that |
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jan 5, 2016
Closes angular#13228 Closes angular#13625 Closes angular#13658 Closes angular#13681
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Jan 6, 2016
Closes angular#13228 Closes angular#13625 Closes angular#13658 Closes angular#13681
Narretz
added a commit
that referenced
this issue
Jan 6, 2016
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In 35498d7, bindToController was changed to allow setting an object hash instead of true.
The object hash works the same as with the scope property, and sets up the bindings to the controller. What it not does is create an isolate scope for the directive. You have to manually set the scope property to
{}
, but you can also set it totrue
or if you don't specify it, now scope is created at all. The commit says this is intentional, but I can't see how this is something that should be possible. Usingscope
with a has always creates an isolate scope, and I can't see why you'd want bindings with a new / no scope. It also defeats the purpose of defining your bindings with bindToController, because you still have to set the scope prop.The whole behavior is actually undocumented, so it's possible not many people are using it. But imo, we should change it so that bindToController with hash creates an isolate scope in all cases.
The text was updated successfully, but these errors were encountered: