angular.io icon indicating copy to clipboard operation
angular.io copied to clipboard

docs(structural-components): add chapter

Open wardbell opened this issue 10 years ago • 8 comments

Copied from ideablade pr 10

Ward says: WORK-IN-PROGRESS! Do not merge

The second half of Filipe's original "Structural Directives" chapter is here.

IMO (and Filipe and Pascal's apparently), that half seemed to depart from the point of Structural Directives and, in fact, defined a new kind of component that did the job of incorporating external content by projection.

This seemed to me to be a new concept, deserving its own chapter. For lack of better terms, I dubbed it the "Structural Component".

So, Filipe, this is something on my plate for review in the not-to-distant future. You may want to take it a next step before I get there. My sense is that a Tab/Tab Pane example fits perfectly in this chapter. Do you agree?

Filipe says: I was trying to move away from tabs because that was Victors example for ng-content (which isn't a strong reason).

But to show DynamicComponentLoader, I think something simpler would be in order since tabs/tab-pane would require a bit more complexity in structure organization.

For instance, the recall button component class could be provided by the parent component, and the dashboard would instantiated it. It would demonstrate that a component class could be referenced and used outside of templates, which is an amazing thing conceptually.

Ward replies: I know Victor did Tabs. But that's on his blog. If that seems the most obvious example of the need to project developer content into a component's template, I'm sure he would not mind.

I would prefer NOT to lead with DynamicComponentLoader. It's cool but not mainstream. Mainstream is the stuff with content children. That said, I'd love to see what you do with it.

wardbell avatar Dec 15 '15 23:12 wardbell

Noticed that @robertmesserle put a very nice and succinct version on the A2.io home page! Source is here. We should steal it.

wardbell avatar Dec 15 '15 23:12 wardbell

It does look steal worthy!

I'll work on this some more soon, and get back to you with a finished chapter.

filipesilva avatar Dec 16 '15 13:12 filipesilva

In a conversation with @teropa it just dawned on me that I haven't covered the simple default case of <ng-content> with no selector, which just transcludes everything in the components light dom.

I need to add a section about that.

filipesilva avatar Dec 21 '15 15:12 filipesilva

I agree with the direction. Carry on!

wardbell avatar Dec 21 '15 17:12 wardbell

@wardbell I've updated the current content and examples to beta.2, added intro, table of contents and other minor edits.

This PR at the moment does not include all the additions previously discussed, but it is functional and complete as is. We can come back to it later and add more content.

filipesilva avatar Feb 03 '16 21:02 filipesilva

@wardbell I've rolled this chapter into structural directives, as we discussed.

filipesilva avatar Mar 10 '16 18:03 filipesilva

@wardbell @filipesilva - still actual?

ghost avatar Apr 07 '17 06:04 ghost

We will revisit this kind of PRs soon.

Foxandxss avatar Apr 07 '17 10:04 Foxandxss