37 questions
1
vote
1
answer
74
views
TemplateRef in Angular 18 missing context
What am I missing here? The template seems to render but the context is empty, resulting in just an empty button being displayed. Written with Angular 18.
import { AfterViewInit, Component, ElementRef,...
2
votes
2
answers
116
views
Updating a template using signals within a @for loop is not working
I have been trying and experimenting with a load of different approaches, but I cannot seem to get it working that my template gets updated.
Currently the situation: I have an Angular 19 app, ...
1
vote
1
answer
54
views
How to use unique reference in a loop
With Angular I am using this date time picker in loop and I need to assign a unique reference. So far I hardcode it to req_d1 but it creates some problem. I would like to know how could I set a ...
2
votes
2
answers
78
views
Not able to define same template variable twice in the angular template
I have a query regarding the template variable in angular. Actually I was trying to access multiple elements with the help of the @ViewChildren() decorator.
But when I was defining two element with ...
1
vote
1
answer
468
views
passing data between ng-template to ng-content (Angular 17)
How to pass lists$ from list.component to ng-template
im provided code you could see the pipeline of function calls and how the ng-template passes to modal.compoent.html.
.................................
0
votes
0
answers
30
views
How to use object keys or variables with the special characters in Angular templates
In my Angular app I use the data from yaml file which looks like this:
id: 'test'
restart-seconds: 20
...
I need to display this data in the Angular material table (code is below).
Because one of the ...
0
votes
0
answers
29
views
Display Html element according to a template variable
An HTML template of my application has 3 div
Each of these divs has a specific template variable.
Let’s assume the following code:
<div class="container">
<div #variable1>Some ...
4
votes
2
answers
2k
views
How to update the styles of @ViewChildren (Or @ContentChildren) in Angular(v14)
I'm trying to create a carousel component that has n amount of child components based on whatever size list it will get. I want the parent (carousel) to control the styling for children as it ...
3
votes
1
answer
3k
views
How to create template reference inside the `ngFor` loop with angular?
i am trying to create template reference through ngFor loop. but not works.
ts file:
import { Component, VERSION } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app....
-1
votes
1
answer
52
views
Rewrite angular directive which uses template variables
I've written a structural directive which sets the itemTemplate on my custom Select2Component
@Directive({ selector: '[bsItemTemplate]' })
export class BsItemTemplateDirective {
constructor(private ...
0
votes
1
answer
1k
views
angular ViewChild isnt working inside a ngIf statement
I am trying to show student data in a table according to a selected course
in my app.componenet.html:
<div class="column">
<app-courses-list #child></app-courses-list&...
0
votes
1
answer
33
views
Angular list grouped by initial letters OR re-assign variable in template problem
In Angular I have a long list of words which I display in template as <li> using *ngFor loop.
Because the list is so long, I want to make sections by initial letter. The list is already sorted ...
-1
votes
1
answer
379
views
How can I get access to a template generated local variable to component code?
Maybe I'm thinking in the completely wrong direction. But what I would like to do is call the value of a variable, which was defined in the template, in the component.
<button (click)="...
0
votes
1
answer
628
views
How can I bind multiple actions to a single Angular output?
How can I bind multiple actions to a single Angular output, without creating any additional methods?
An example would be updating the value of a formControl based on an output from a custom component ...
1
vote
0
answers
317
views
How to getting a reference to elements within the container of an angular structural directive
I have the following template with a test structural directive called *appUnless:
<h1 *appUnless>
<app-hello></app-hello>
<input type="text" value="hello" /...