Skip to content

refactor(ngContent): rename <ng-content> to <ng-slot> #3882

Closed

Description

@0x-r4bbit

Turns out that the Shadow DOM's spec <content> element has been deprecated and is now called <slot>.

Do we want to align <ng-content> accordingly?

https://w3c.github.io/webcomponents/spec/shadow/#slots

Activity

  1. 0x-r4bbit commented on Sep 16, 2015

    @0x-r4bbit
    ContributorAuthor

    I think I saw in the weekly meeting notes that <ng-content> is going to stay and <ng-slot> will be added

  2. mhevery commented on Sep 28, 2015

    @mhevery
    Contributor

    @tbosch can you comment

  3. tbosch commented on Oct 9, 2015

    @tbosch
    Contributor
    • We already have our own semantics behind it (see Static content projection)
    • using selectors allows to build components with a nicer API (a user does not have to use the slot attribute for child nodes).
    • Performance is not an issue for Angular as we precalculate the content projection during compilation, which will eventually end up in a build step.

    So far we stick with <ng-content>...

  4. tbosch commented on Oct 9, 2015

    @tbosch
    Contributor

    We can add ng-slot trivially though, if users really want it...

  5. vicb commented on Oct 9, 2015

    @vicb
    Contributor

    IMO renaming it to <ng-slot> would be confusing for users (vs <slot>).

  6. 0x-r4bbit commented on Oct 11, 2015

    @0x-r4bbit
    ContributorAuthor

    We can stick with just slot too, the more interesting question is, if we want to implements this or not. @tbosch thank you for the doc! I just read it and it makes also (finally) clear why we have ng-content.

    So based on that document it really seems like slot is not hard to implement as it boils down to ng-content select="[slot...", however, I'd say we can add this, as soon as people are actually asking for it. I could imagine that very few users (if at all) will have a use case for that. That might change in the future tho.

  7. mhevery commented on Oct 26, 2015

    @mhevery
    Contributor

    We should stick with content. We have content injection, content change detection, contentBindings, etc. In all of those cases slot does not make sense.

    We may implement the new functionality, but that is outside the scope of this issue.

    Closing.

  8. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions