Questions tagged [ng-container]

79 questions
1
vote
1 answer

How to render ng-template dynamically with Template Reference in Angular

I tried the example in this question Dynamic ngTemplateOutlet value but still, no success. I want to dynamically display an ng-template form based on the option selected by the user. I have defined global variables and 3 forms with their Template…
chris
  • 2,490
  • 4
  • 32
  • 56
1
vote
0 answers

angular 9 add constructor parameter, then html render not correctly

I create a component in angular 9, and I use in the component to inject the html. so far, it's still very normal ( render html correctly). but after I add parameter in constructor, then the html in component not render in browser, only render the…
user2956843
  • 177
  • 1
  • 10
1
vote
1 answer

Angular 8: Not Showing the content of ng-tmplate in nested structure

I have a model that in its structure has a list and one enum property like this: export class myModel { Items: any[]=[]; ItemsType: ItemType; } and I want to show the list of my model in the template with ng-container and ng-template but…
hosein
  • 139
  • 1
  • 4
  • 14
1
vote
1 answer

ngTemplateOutlet inside angular materials autocomplete only renders with default option

I am trying to create a set of custom templates using materials autocomplete and ngTemplateOutlet to switch in which template I want to use to display the results (e.g. if there are grouped results they will display differently to traditional…
1
vote
1 answer

ng-content inside ng-template appears only in one ng-container

I'm creating a flip panel. The panel is composed in three parts. panel-tool-bar panel-front panel-back The tool-bar has a fix part, the flip button. In my flip-panel.component I have a ng-template for the tool-bar because the tool bar should be…
admir86
  • 368
  • 1
  • 3
  • 13
1
vote
1 answer

HTML table created using *ngFor, populated with a separate *ngFor, last column to contain *ngIf

New to stack overflow and fairly new to Angular - say intermediate level. So I have an issue where I'm using an *ngFor loop to create and populate the first three columns of an HTML table, I then want to use a separate *ngFor condition to loop…
1
vote
1 answer

Mat-Table matCellDef issue with mapping model which has special character

The data I got from a different REST API has field names with special characters and spaces in between them. For example, instead of passing row.DatasetID like this:
Balaji R
  • 11
  • 2
1
vote
1 answer

How can I test elements wrapped in an ng-container exist for Angular 6 with Jasmine?

I am trying to write a unit test to see whether or not elements wrapped in an exist, but my tests fails because it seems the elements are created any way. My code is: HTML
J-man
  • 1,743
  • 3
  • 26
  • 50
1
vote
1 answer

Why ng-container showing my td tag and template element does not showing my td tag?

I want to show td tag if my statement is true. So I am using