Skip to content

Renderer: Is it possible to get a reference to transcluded content? #2320

Closed

Description

@matanlurey

E.g., I have the following component:

@Directive(selector: '[bar]')
class BarDirective {
  final ElementRef elementRef;
  final ProtoViewRef protoViewRef;

  BarDirective(this.elementRef, this.protoViewRef);
}

@Component(selector: 'foo')
@View(
  template: r'''
    <template bar>PRE<content></content>POST</template>
  '''
)
class FooComponent {}

If I grab bar's elementRef/protoViewRef, and add it to a view container elsewhere it only contains:

PREPOST

Is that working as intended?

@tbosch

Activity

  1. matanlurey commented on Jun 3, 2015

    @matanlurey
    ContributorAuthor

    Talked to tbosch@, because the native shadow DOM would not support this, neither does Angular's emulated layer. It may be possible to do something like this in the future as Angular evaluates alternatives. See also #1931.

  2. naomiblack commented on Jun 4, 2015

    @naomiblack
    Contributor

    @tbosch is P3 correct? Should this be P4?

  3. tbosch commented on Jun 13, 2015

    @tbosch
    Contributor

    This will be solved by #2529

  4. added this to the alpha-29 milestone on Jun 15, 2015
  5. self-assigned this
    on Jun 15, 2015
  6. modified the milestones: alpha-31, alpha-29 on Jul 1, 2015
  7. modified the milestone: alpha-31 on Jul 1, 2015
  8. modified the milestones: alpha-31, alpha-32 on Jul 11, 2015
  9. tbosch commented on Jul 16, 2015

    @tbosch
    Contributor

    This is solved with the new content projection. I also added test to ensure this here: https://github.com/angular/angular/blob/master/modules/angular2/test/core/compiler/projection_integration_spec.ts#L307

  10. angular-automatic-lock-bot commented on Sep 6, 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.

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

Metadata

Metadata

Assignees

Labels

effort1: hoursfeatureLabel used to distinguish feature request from other issues

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions