85 questions
-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;"&...
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"
},
{
&...
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 } ...
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>
...
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 ...
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 ...
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 ...
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 ...
-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",
&...
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">
...
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 ...
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....
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 ...
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 ...
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 ...
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
[...
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 ...
-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 ...
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&...
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 ...
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....
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 ...
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]...
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. ...
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-...
-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 ...
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-...
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 ...
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 ...
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'...
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 ...
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">
<!--...
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 ...
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 ...
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 ...
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 ...
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>...
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 ...
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', ...
-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" [(...
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-...
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-...
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) ...
-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 ...
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<...
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 ...
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:...
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 ?
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 ...
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 ...