This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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
Closed
Description
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:
- Most component don't need it. And it's find to enable it when you need it.
- It doesn't play well with some native directive also requiring transclusion (namely ngSwitchWhen)
For instance when creating a simple component with
module.component('myComp',
{
template:'<div></div>'
}
);
And use it in a template like this:
<div ng-switch="x">
<my-comp ng-switch-when="1"></my-comp>
<div ng-switch-when="2"></div>
</div>
I get the following error:
[$compile:multidir] Multiple directives [ngSwitchWhen, myComp (module: myApp)] asking for transclusion on: <my-comp ng-switch-when="1">