-
Notifications
You must be signed in to change notification settings - Fork 27.4k
change suggestion for new Multi-slot transclusion feature #13439
Comments
@petebacondarwin What do you think about this? |
Reasonable. Let's consider this |
Thanks |
I looked at the updated documentation where is says: In a scope object if the attribute name was some-attribute the scope object would say 'localname':'@someAttrbute" I would expect the transclusion object to follow the same syntax. i.e. |
We need to clarify this in the docs but we decided that in the case of the transclusion map, the values are actually element selectors, to allow us to consider supporting more complex selectors in the future. Therefore you must provide the exact name of the element rather than a "canonical" form. |
Although this does make sense in a way, the same logic would also apply from the scope object. i.e. why use scope:{'localName':'@myAttribute'} not use scope:{'localName':'@my-attribute'} ? IMHO It would be a better choice for now to be consistent and use the "canonical" form as in scope and only at a later stage relax this requirement and allow using a more complex syntax on all such maps (transclusion, scope & bindToController). b.t.w - even now - allowing a ? at the beginning of the value makes it not to be "an actual element selector". one last point/question - I what scenario would you expect a more powerful selector to be used in the transclusion map? Do you think that something stronger then a sub element name would ever be used? Thanks for a great job and for listening. |
In the original prototypes of this feature, people were able to match on all kinds of CSS selector, such as That being said I guess that we could probably work around that by, say, checking for uppercase characters in the matcher, which would indicate a canonical form. So I guess we can indeed revert that aspect of this PR and allow canonical form. |
Closes angular#13439 BREAKING CHANGE: The keys and values for the `transclude` map of the directive definition have been swapped around to be more consistent with the other maps, such as `scope` and `bindToController`. Now the key is the slot name and the value is an element selector.
Closes angular#13439 BREAKING CHANGE: The keys and values for the `transclude` map of the directive definition have been swapped around to be more consistent with the other maps, such as `scope` and `bindToController`. Now the key is the slot name and the value is an element selector.
Closes angular#13439 BREAKING CHANGE: The keys and values for the `transclude` map of the directive definition have been swapped around to be more consistent with the other maps, such as `scope` and `bindToController`. Now the key is the slot name and the value is an element selector.
Hi,
I want to suggest that the structure of the transclude object value shown in the example for https://docs.angularjs.org/api/ng/directive/ngTransclude (v1.5.0-build.4414 (snapshot)) would be the other way around.
i.e. instead of
it should be (IMHO)
This would be more consistant with similar maps such as those used in isolated scope and bindToController in the sense that the property name should be the internal element to which the binding happens (the value of the ng-transclude attribute in the template in our case) and the value should say how to resolve it from the "outside".
see also http://stackoverflow.com/questions/22079587/angularjs-transcluding-multiple-sub-elements-in-a-single-angular-directive/34063645#34063645 where I actually suggested that such a feature would be helpful.
The text was updated successfully, but these errors were encountered: