r/angularjs • • Nov 13 '15

Exploring the Angular 1.5 .component() method

http://toddmotto.com/exploring-the-angular-1-5-component-method
57 Upvotes

13 comments sorted by

View all comments

4

u/chazzlabs Nov 13 '15

Why is transclusion enabled by default? If I'm creating a component with the default settings but not leveraging transclusion is there a small, unnecessary overhead cost there? We rarely use transclusion in our directives so the fact that it's enabled by default has me curious whether we're designing our directives correctly/optimally.

Great article overall though. I'm excited to use Component. We've been keeping on top of upgrading with each minor release, and so far it's been a breeze.

6

u/elprophet Nov 13 '15

is there a small, unnecessary overhead cost there?

Not really; the cost is negligible to say that transclusion can happen (it's setting a flag during directive setup that has to be set one way or the other). The cost for transclusion is incurred when the transclusion actually happens; eg, when your component depends on and calls the $transclude function.

5

u/toddmotto Nov 13 '15

I think @elpropher answered nicely. Thanks for the feedback, excited to use it too! :)