You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
transclude: true is probably a bad default for component helper #13566
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 transclude property.
So perhaps it would be better to default transclude to false.
We decided to set transclude to true under the assumption that it has no unwanted side effects. If that is not the case we should either reconsider or find a way to work around those side effects.
transclude: false is a good idea. Maybe we should also suggest that component directives should not have other directives on them? Moving to components, I'd personnally keep them separate from each other / other directives.
OK, good call @sarod - let's change the default to false. This will be a breaking change in RC1.
@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...
changed the title [-]true is probably a bad default for component helper[/-][+]transclude: true is probably a bad default for component helper[/+]on Jan 4, 2016
Activity
petebacondarwin commentedon Dec 17, 2015
@sarod - thanks for this feedback.
A simple workaround for your case is to set transclude to be false:
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
transcludeproperty.So perhaps it would be better to default
transcludetofalse.What do others think? @shahata ?
gkalpak commentedon Dec 17, 2015
Indeed
falsemight be a more reasonable default fortransclude.Not directly related to this, but (off the top of my head) shouldn't
transclude: 'element'andtransclude: truebe able to co-exist on an element ?shahata commentedon Dec 17, 2015
We decided to set
transcludetotrueunder the assumption that it has no unwanted side effects. If that is not the case we should either reconsider or find a way to work around those side effects.Narretz commentedon Dec 17, 2015
transclude: falseis a good idea. Maybe we should also suggest that component directives should not have other directives on them? Moving to components, I'd personnally keep them separate from each other / other directives.lgalfaso commentedon Dec 17, 2015
I think that
transclude: falseis a safer defaultpetebacondarwin commentedon Dec 17, 2015
OK, good call @sarod - let's change the default to
false. This will be a breaking change in RC1.@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...
[-]true is probably a bad default for component helper[/-][+]transclude: true is probably a bad default for component helper[/+]