Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-container display issue #16103

Closed
etovian opened this issue Apr 18, 2017 · 7 comments
Closed

ng-container display issue #16103

etovian opened this issue Apr 18, 2017 · 7 comments
Labels
area: core Issues related to the framework runtime needs reproduction This issue needs a reproduction in order for the team to investigate further

Comments

@etovian
Copy link

etovian commented Apr 18, 2017

I'm submitting a ... (check one with "x")

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Nesting ng-container in a transclusion results in the following error:

TypeError: Cannot read property 'display' of undefined
at BaseFxDirectiveAdapter.BaseFxDirective._getDisplayStyle
...

Expected behavior

The ng-container would render its contents.

Minimal reproduction of the problem with instructions
Nest ng-container in a component that supports transclusion, like so:

<user-form [user]="user" (submitted)="submitted($event)"> <ng-container class="additional-actions"> <button md-raised-button> Button One </button> <button md-raised-button> Button Two </button> </ng-container> </user-form>

It should be noted that the individual buttons can implement the "additional-actions" class directly, and the html will render without error:

<user-form [user]="user" (submitted)="submitted($event)"> <button class="additional-actions" md-raised-button> Button One </button> <button class="additional-actions" md-raised-button> Button Two </button> </user-form>

What is the motivation / use case for changing the behavior?
Allow ng-container to render child content in a transclusion.

Please tell us about your environment:
@angular/cli: 1.0.0
node: 6.10.0
os: win32 x64
@angular/animations: 4.0.1
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/flex-layout: 2.0.0-rc.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/material: 2.0.0-beta.3
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1

  • Browser:
    Chrome, Version 57.0.2987.133 (64-bit)

  • Language:
    Typescript 2.2.0

@tbosch
Copy link
Contributor

tbosch commented Apr 18, 2017

Hello, we need a reproduction for this...

@tbosch tbosch added area: core Issues related to the framework runtime needs reproduction This issue needs a reproduction in order for the team to investigate further labels Apr 18, 2017
@etovian
Copy link
Author

etovian commented Apr 19, 2017

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'repro-error',
  template: `
    <div>
      <parent>
        <ng-container class="nested-content">
          <button>Click Me</button>
        </ng-container>
      </parent>
    </div>
  `
})
export class ReproErrorComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}

@Component({
  selector: 'parent',
  template: `
    <div>
        <ng-content select=".nested-content"></ng-content>
    </div>
  `
})
export class ParentComponent {

}

@etovian
Copy link
Author

etovian commented Apr 19, 2017

Those components will reproduce the problem. If you move the button out of the ng-container, remove the ng-container from the component, and add the nested-content class to the button, it should work as expected.

@vicb
Copy link
Contributor

vicb commented Apr 19, 2017

can not reproduce https://plnkr.co/edit/w8FdYIINi5W0l4i24HnI?p=preview

Please link a plunker next time you report an issue. Thanks.

@vicb vicb closed this as completed Apr 19, 2017
@LastDragon-ru
Copy link

LastDragon-ru commented Oct 22, 2017

can not reproduce

If you put <tr> inside ng-container it will not work :(

https://plnkr.co/edit/xRuoiILaPtSliQ8KEGCB

PS: Seems related to #18314?

@BenevidesLecontes
Copy link

BenevidesLecontes commented Dec 15, 2017

I'm having this issue on ie11. And it work on all other browsers.

@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 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime needs reproduction This issue needs a reproduction in order for the team to investigate further
Projects
None yet
Development

No branches or pull requests

5 participants