question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng-container display issue

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
LastDragon-rucommented, 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?

0reactions
angular-automatic-lock-bot[bot]commented, Sep 13, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng-container issue with "Error trying to diff..." - Stack Overflow
How do I use ng-container with *ngFor clause properly to display the data inside nested dataTable ? I cannot access this data, no...
Read more >
Angular “ng-container”: A Must-Know for Developers
ng -container is not rendered on the screen as an element, instead, it is displaced as a comment in HTML. We can group...
Read more >
Angular ng-template, ng-container and ngTemplateOutlet
This is a Complete Guide To Angular Templates: it covers ng-template, ng-container, the ngTemplateOutlet structural directive, and more.
Read more >
ng-container - Angular
A special element that can hold structural directives without adding new elements to the DOM. See more... Descriptionlink. The <ng-container> allows us to ......
Read more >
How To Use the ng-container Element in Angular - DigitalOcean
ng -container can also resolve the problem of invalid HTML markup in situations where using a div or span would not be valid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found