Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
2 answers
98 views

How to get checked checkbox vaule inside ngFor/ngIf?

I have data like so: const List: Array<Item> = [ { id: 1, name: 'somename' } ... ] Then html looks like this: <ng-container *ngFor="let item of list; let i = index;"&...
dozobus's user avatar
  • 29
1 vote
0 answers
34 views

Template-driven forms cannot capture data from dynamically added form controls

I have a list of categories where users can edit their titles and then submit or cancel the changes. [ { "title": "Personal", "color": "#ff6b6b" }, { &...
Wassim Maaoui's user avatar
0 votes
0 answers
259 views

Issue with ngComponentOutlet: "ASSERTION ERROR"

I am developing a component that accepts other components and displays them. Here the code of the component ts: import { NgComponentOutlet, NgFor } from '@angular/common'; import { Component, Input } ...
Alessandro Biagini's user avatar
1 vote
1 answer
76 views

Angular throws missing MatFormFieldControl error in mat-form-field when it's referenced by a template. Direct insert works fine

So this is the working code: <mat-form-field *ngIf="asFormFieldWithLabel; else selector" style="width: 100%;"> <mat-label>{{asFormFieldWithLabel}}</mat-label> ...
Toni Kanoni's user avatar
  • 2,317
0 votes
2 answers
603 views

Use of $implicit do not pass value when using content projection

While playing with the concept of ng-template (html to to render), ng-container (work with ng-template for rendering) and ng-content (content projection), I'm having trouble to make use of $implicit ...
Puygrenier Solann's user avatar
1 vote
2 answers
968 views

Angular 16+ conditionally render one of several templates using ngTemplateOutlet

I have 3 templates inside tempaltes.component. Inside item.component I need to pick one of the templates conditionally, and pass it down to the header.component to render, but somethingnot right with ...
PVG's user avatar
  • 822
1 vote
1 answer
55 views

ngIf need to be handled in ngcontainer

when update flag is set to true, need to check whether field has any change in value. If value changed need to strikethrough old value and updated new value in bold. this works for totalMarks but I ...
Nicoleta Wilskon's user avatar
1 vote
1 answer
72 views

Dynamic content creation

I need your help. I have two different components Stage i Executor. Inside the Stage component, I try to create new elements, the number of which depends on the input parameters, and in the Executor ...
Alexandr Boroshenko's user avatar
-1 votes
1 answer
47 views

Angular -How to display or loop though array of arrays

I would like to display the list of arrays that contain arrays inside. I have arrays as below with dummy data [ [ { "date": "September 11", &...
user3933327's user avatar
0 votes
2 answers
834 views

How to avoid Angular using extra tag for a child component?

Let's say I have parent and child component in Angular 12. For example, their templates looks like this: Parent: <h1>This is parent component</h1> <div class="container"> ...
Vladimir99's user avatar
0 votes
1 answer
680 views

Angular MatTable with column definition from parent

Objectif: Creating a component app-table which would contain some definitions of columns that are common to multiple tables + giving inside the bracks some more definitions from the parent to the ...
Python's user avatar
  • 37
0 votes
1 answer
2k views

Unable to use ngClass with ng-container to build table, Angular

I have a generic table component and I want to make the row hoverable by binding class using ngClass to a ng-container. However I an error. The code: <ng-container *ngFor="let row of manager....
Franco's user avatar
  • 858
2 votes
1 answer
290 views

Display 2 input fields within ng-container and div side by side in bootstrap

I'm trying to display 2 input fields and a button side by side. Tried many combinations, but still no luck. The code block of the and is below. Can you please help on how to make them on the same ...
Harry's user avatar
  • 548
0 votes
1 answer
79 views

Static menu inside my children components with routing

I want my static menu to be inside my both children components, how to achieve that? I tried with ng-template, ng-content, ng-container, ngTemplateOutlet directives but I didn't find an example that ...
A. Morel's user avatar
  • 10.2k
0 votes
1 answer
676 views

Hey, so is there a way to nest ngTemplateOutlets? I am trying to create a simple customizable modal

I am trying to create a simple customizable modal. Where I can pass via Input() decorator a TemplateRefs and then my component would render that. I am passing 2 TemplateRefs. 1 - The black backdrop, 2 ...
Freddy Momonosuke's user avatar
1 vote
1 answer
819 views

Trying to use ngModel inside of ng-template

I am trying to use ng-template and ng-container, alongside primeng to have dynamic cells in my table: <tr *ngFor="let data of tableData"> <ng-container [...
manjiro sano's user avatar
3 votes
0 answers
603 views

eCharts Tooltip Formatter - Possible to use Angular ng-container?

I want to include ng-container in my eCharts Tooltip formatter. I found the following link (How to format the tooltip value in echart (angular)) and it is working to create a simple HTML output, but I ...
snibbo's user avatar
  • 190
-1 votes
1 answer
2k views

How to implement Primeng Reusable Table using ngTemplateOutlet

I'm trying to create reusable component which have primeng-table. This reusable component will accept input as data and col to display in table. In user component, I'm just using prime-table component ...
Chandru's user avatar
0 votes
1 answer
1k views

Angular FormGroup: How to move formControlName to a ng-template outside FormGroupName?

This code is working: <form id="list" [formGroup]="Form"> <ion-list lines="none" class="list"> <ion-item-sliding formArrayName="things&...
João Otero's user avatar
0 votes
1 answer
612 views

Make grouped rows in table

I have a class with 3 objects in a class that I push in an array and I have to display them grouped in an array like below. Each line has to be an object. The problem is that I can't find a way to ...
leri's user avatar
  • 311
1 vote
1 answer
210 views

Adding ngIf to script tag in html not working

I am trying to add a src to a script in my html file, but only if a condition is true. Otherwise it should not have run the script src. Below is my code so far: <script> this....
user avatar
0 votes
1 answer
681 views

How can a regular (breaking) space be added between items rendered using ng-container and ngFor in Angular to allow word wrapping

When rendering html anchor tags in an ng-container using ngFor, spaces between the tags are removed. The result is that the contents overflow the parent container. I've tried adding a space inside a ...
Alex Cooper's user avatar
2 votes
2 answers
15k views

Adding Dynamic Content inside <ng-template>

<ng-template #reuse> <div>Hello World</div> </ng-template> <ng-container [ngTemplateOutlet]="reuse"></ng-container> <ng-container [ngTemplateOutlet]...
Ramya Balasubramanian's user avatar
3 votes
2 answers
2k views

Angular 11+ MatDialog: inner component's (ngComponentOutlet) html does not trigger <button (click)="close()"> method. Works on Angular 9

In fact, I'm having more issues with the ngComponentOutlet-embedded component inside the MatDialog. But let's start here. What I'm building I want to display an arbitrary Component inside a MatDialog. ...
netikras's user avatar
  • 512
0 votes
1 answer
142 views

Issues with *ngFor and GridLayout in Nativescript

I have a problem with the grid layout. My code is this one: <GridLayout padding="10%"columns="auto, auto, auto, auto, auto, auto, auto" rows="*"> <ng-...
FedericoAntosiano's user avatar
-1 votes
1 answer
2k views

Testing and anchor tag click inside a ng-container embbeded in a ng-switch

I´m really new about testing in angular and I, couldn´t have found a solution for this problematic. Im trying to do a test over a method that is called once an anchor tag is clicked. This anchor tag ...
Enrique Gordon Felix's user avatar
1 vote
2 answers
2k views

add tootip in mat-tab if using ng-container

I have issues to add tootip in mat-tab if I use ng-container. <mat-tab-group> <mat-tab label="Users" > <ng-container *ngTemplateOutlet="users"></ng-...
Bigeyes's user avatar
  • 1,666
0 votes
0 answers
247 views

Making the label of dynamic field clickable

I'm working on a site with a bunch of form elements that are inserted dynamically from a hard-coded list myFormElements:ElementBase. Each element has a string label, and now I need to make these ...
mana's user avatar
  • 21
1 vote
1 answer
1k views

Create Angular component that behaves like ng-container

How can an Angular component behave like <ng-container> in that only its content is found in the DOM finally. In particular, if itself is written with content, the content shall end up in the ...
Harald's user avatar
  • 5,063
5 votes
1 answer
10k views

How to pass data to ng-template from conditional ng-container

My data model: export class Contact { constructor( public type: ContactTypes, public name: string, public link?: string ) { } } export enum ContactTypes { Address = 'address-card-o'...
Serhii's user avatar
  • 7,533
0 votes
0 answers
522 views

Mat Cards not rearranging to same line after ngIf filter

I'm trying to understand what part of my code is causing the mat-cards I have on my dashboard to not fill the same row after the toggle button is clicked to fulfill the *ngIf condition. I used the ...
NV90's user avatar
  • 19
0 votes
0 answers
946 views

Build Nested Angular Material MatMenu with *ngFor got errors

I try to build nested(two levels) MatMenu in angular material components, but when I run it in browser, errors occurred. component.html: <!-- header --> <div class="header"> <!--...
francistts's user avatar
0 votes
1 answer
506 views

In an Angular *ngFor loop, can I output or render to different / multiple locations in my template?

I have an array of items, each with a category that is sometimes shared. What I want to do is group the items in my template by their category. Currently I'm achieving this by simply looping the array ...
KDill's user avatar
  • 1
1 vote
1 answer
1k views

Angular Mat Table inline editable template not working for empty data cell

I have Angular Mat-table with inline edit .with the code below inline edit works fine for mat cell with record but for cell with null values or empty record inline edit does not works. i would be ...
subash's user avatar
  • 4,137
2 votes
0 answers
599 views

Angular ngTemplate, ngTemplateOutlet, ngContent: Select Contents of Template

Angular ngTemplate, ngTemplateOutlet, ngContent: Select Contents of Template I have 2 components: AppComponent (<app></app>) and ModalComponent (<modal></modal>). Nothing is ...
Cody's user avatar
  • 9,995
0 votes
0 answers
161 views

Why are the form inputs in my html table unclickable?

I am trying to render a table in html that is the representation of a reactive form array. I loop over the complex object (FormGroup > FormArray > FormGroup > FormArray) With the final array ...
bflynnigan's user avatar
0 votes
2 answers
1k views

Reusing content of Angular ngb-tabs in multiple tabs with ngTemplateOutlet or something else

I am using Angular ng-tabset to render some tabs. My ngb-tab looks somewhat like: <ngb-tab id="mytabs"> <ng-template ngbTabTitle> <div data-locator="xxxe">yyy</div>...
user1892775's user avatar
  • 2,101
1 vote
0 answers
273 views

Angular dropdown changing other dropdowns

I have a situation when i select the drop down it changes the value in other dropdowns on the page as well. I tried to figure out what was causing the issue and i notice that it goes away if i remove ...
dhinkatika's user avatar
1 vote
1 answer
3k views

angular 8: single ng-container for multiple view child references

I have three viewchild decorators in my component like this: @ViewChild('propertiesPage1', { read: ViewContainerRef, static: true }) propertiesPage11: ViewContainerRef; @ViewChild('propertiesPage2', ...
Anamika Yadav's user avatar
-1 votes
1 answer
2k views

How to pass template to nested component in Angular

i am building autocomplete in NativeScript and Angular (this question is valid for pure Angular also). Markup looks like this: <StackLayout> <TextField #keywords [hint]="options?.hint" [(...
Vytautas Pranskunas's user avatar
0 votes
1 answer
753 views

Angular 7 - ngTemplateOutlet Variable Value (Expression)

I am unable to pass the value of *ngTemplateOutlet in my ng-container via a variable. app.component.ts export class AppComponent { templateName="SingleSelect"; } app.component.html <ng-...
Dave Collier's user avatar
2 votes
0 answers
727 views

Dynamic Tagging in ng-template and use with ng-container *ngTemplateOutlet

I have an *ngFor which iterates through users like: <div *ngFor="let user of users> </div> I want to create ng templates like this: <div *ngFor="let user of users> <ng-...
Iraklis Bekiaris's user avatar
0 votes
1 answer
2k views

Angular - how to move entire mat-footer-row to top of table

I am working with a material table with ng-container having 3 things: a) th(mat-header-cell) b) td(mat-cell) c) td(mat-footer-cell) In this table, the footer row (totals of data in preceding rows) ...
nhmishaq's user avatar
-1 votes
2 answers
3k views

Angular 8: how to use ngFor without html tags. I tried ng-container but it not works

After I faced lot of issues I created this following idea to make a fill in the blanks question in my angular project. The objects shown below are getting from API and I want to loop it like this ...
carte's user avatar
  • 77
2 votes
2 answers
6k views

Injecting component to ng-container? (load ng-template from file)

I'm trying to build a simple tabs-menu in my Angular app. parant.component.html: <div> <button (click)="selectTab(1)">Tab1</button> <button (click)="selectTab(2)">Tab2<...
Gil Epshtain's user avatar
  • 9,742
1 vote
1 answer
1k views

ng-container with *ngIf else template don't work with ContentChildren QueryList

I'm trying to dynamicly change content of component by @ContentChildren and QueryList usign ng-container *ngIf="condition; else tplRef", when condition is true ng-container content is visible by ...
Przemek Pobuta's user avatar
0 votes
0 answers
1k views

how to get an instance of component which has placed inside ng-template?

i have doubts in angular ng-template. i have used mycomponent inside ng-temmplate then itried to take an instance of my component but it returns undefined I have tried like below: Sample - https:...
Kumaresan Sd's user avatar
  • 1,516
7 votes
3 answers
14k views

Is there some way to bind a click to a ng-container?

I've got a component made of a ng-container, I would like to bind a click on it. (click) doesn't do the job. Is there another way to do it ?
Matthieu Riegler's user avatar
2 votes
1 answer
5k views

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 ...
chris's user avatar
  • 2,780
1 vote
0 answers
918 views

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 ...
user2956843's user avatar