-
Notifications
You must be signed in to change notification settings - Fork 27.4k
transclude: true is probably a bad default for component helper #13566
Comments
@sarod - thanks for this feedback.
I am willing to consider that many components do not require transclusion. Moreover that if you want multislot transclusion then you would still need to provide the So perhaps it would be better to default What do others think? @shahata ? |
Indeed Not directly related to this, but (off the top of my head) shouldn't |
We decided to set |
|
I think that |
OK, good call @sarod - let's change the default to @Narretz - although we should discourage multiple components on a single element, it seems like a common case to use a component on an element that has a structural directive, such as ng-if, ng-repeat, ng-swtich-when and so on. It just happens that these guys all use transclusion too. As @gkalpak points out - perhaps we ought to support element transclusion and content transclusion on the same element... |
…lper Use false as default value of transclude in component helper. The change is motivated by the fact that using transclude:true when not necessary made component not usable in conjunction with structural directives requiring transclusion like ng-switch-when. Closes: angular#13566 BREAKING CHANGE: This is a breaking change compared to 1.5.0.rc.0 where transclude was true by default.
PR #12933 introduces the new component helper which is great.
However I found that using
transclude:true
as a default is probably a mistake as:For instance when creating a simple component with
And use it in a template like this:
I get the following error:
The text was updated successfully, but these errors were encountered: