Skip to content

Conversation

@devversion
Copy link
Member

With Ivy, injecting a ViewContainerRef for a <ng-container> element
results in two comments generated in the DOM. One comment as host
element for the ElementContainer and one for the generated LContainer
which is needed for the created ViewContainerRef.

This is problematic as developers expect the same anchor element for
the LContainer and the ElementContainer in order to be able to move
the host element of <ng-container> without leaving the actual
LContainer anchor element at the original location.

This worked differently in View Engine and various applications might
depend on the behavior where the ViewContainerRef shares the anchor
comment node with the host comment node of the <ng-container>. For
example CdkTable from @angular/cdk moves around the host element of
a <ng-container> and also expects embedded views to be inserted next
to the moved <ng-container> host element.

See: https://github.com/angular/components/blob/f8be5329f8d94128ece5dfe3e8e998fe4077d44d/src/cdk/table/table.ts#L999-L1016

Resolves FW-1341

With Ivy, injecting a `ViewContainerRef` for a `<ng-container>` element
results in two comments generated in the DOM. One comment as host
element for the `ElementContainer` and one for the generated `LContainer`
which is needed for the created `ViewContainerRef`.

This is problematic as developers expect the same anchor element for
the `LContainer` and the `ElementContainer` in order to be able to move
the host element of `<ng-container>` without leaving the actual
`LContainer` anchor element at the original location.

This worked differently in View Engine and various applications might
depend on the behavior where the `ViewContainerRef` shares the anchor
comment node with the host comment node of the `<ng-container>`. For
example `CdkTable` from `@angular/cdk` moves around the host element of
a `<ng-container>` and also expects embedded views to be inserted next
to the moved `<ng-container>` host element.

See: https://github.com/angular/components/blob/f8be5329f8d94128ece5dfe3e8e998fe4077d44d/src/cdk/table/table.ts#L999-L1016

Resolves FW-1341
@devversion devversion added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release comp: ivy labels May 22, 2019
@devversion devversion requested a review from a team May 22, 2019 11:23
@ngbot ngbot bot added this to the needsTriage milestone May 22, 2019
@pkozlowski-opensource
Copy link
Member

@devversion thnx, the change itself LGTM. I was just wondering if you could add an acceptance test for the exact use-case that was discovered in Material (moving around comment node). WDYT?

@devversion
Copy link
Member Author

@pkozlowski-opensource Thanks for reviewing. The acceptance test I added should already cover that scenario. It's not an exact test-case but covers the exact same use-case. can you please re-check and let me know if this is sufficient? Thanks!

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one optional nit

@kara kara added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 22, 2019
@kara kara added the action: presubmit The PR is in need of a google3 presubmit label May 22, 2019
@kara
Copy link
Contributor

kara commented May 22, 2019

presubmit

@kara kara removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label May 22, 2019
@kara kara added action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit and removed action: presubmit The PR is in need of a google3 presubmit labels May 22, 2019
@ngbot
Copy link

ngbot bot commented May 22, 2019

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "google3" is failing
    pending status "ci-codefresh-bazel" is pending

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@kara kara added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: presubmit The PR is in need of a google3 presubmit labels May 22, 2019
@kara
Copy link
Contributor

kara commented May 22, 2019

merge assistance: code fresh delayed

@jasonaden jasonaden closed this in fa6cbb3 May 22, 2019
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants