Questions tagged templates

Explore the latest questions and answers asked by our top developers.

What is the parser used for Angular templates to generate AST

Normally eslint for typescript code uses @typescript-eslint/parser to parse the ts/tsx code. But what parser is used in parsing a angular template(.html)?. I am trying to create a custom eslint plugin for angular template files. To begin with that I don’t find any parser for angular templates in Can anyone point me to proper […]

Render Angular components in different parts of the root template

Given the following Angular view: <accordion> <accordion-item heading="Item #1"> The content of the first menu item #1 goes here… </accordion-item> <accordion-item heading="Item #2"> <other-component> </other-component> </accordion-item> <accordion-item heading="Item #3"> The content of the third menu item #3 goes here… </accordion-item> </accordion> How can I render template of the accordion-item component in one part of template […]

By Agent Coop
Categorized as angular, frontend, templates Tagged , ,

What are better ways to avoid using method calls within Angular Templates?

I am trying to avoid using method calls within Angular Templates as they are non-performant there. Lets say I have a list of names: const names: string[] = [‘Billy’, ‘Mandy’, ‘Carl’, ‘Sheryl’] and in my template im using an ngFor to iterate the list and print the names: <ng-container *ngFor="let name of names"> <p>{{ name […]

Is there way to declare an abstract component in Angular so that it can be used in a template?

I would like to create an abstract component in my Angular application that has a template that can be reused by my components that extend the abstract one. Below is a simple example of what I’m trying to do: @Component({ selector: ‘app-abstract’, templateUrl: ‘<ng-content></ng-content> {{ title }} Component’, changeDetection: ChangeDetectionStrategy.OnPush }) export abstract class AbstractComponent […]

Visual Studio 2022 Standalone Typescript Angular template not working

I have followed the instructions at ( to the letter, but cannot seem to get the frontend part to talk to the backend part. No matter what, it appears to be looking for the API at port 4200, which doesn’t seem to be the setting in any JSON file. If I go to https://localhost:7176/swagger/index.html I […]

Angular – Passing dynamic HTML to component as variable

I’m building a component which is basically a menu that reuses some Angular Material mechanisms and I would like to allow the users to add some icons dynamically so they’ll be able to add some interactivity like onclick events (for example). I’ve set it this way in my component logic (.ts): @Input() additionalIcons: HTMLElement[]; And […]

By TyrionGraphiste
Categorized as angular, dynamic, templates Tagged , ,

Observable with simple Stream in Template

I know this have to be a simple question. Why this doesn’t work: observablesEx01() { return new Observable<number>(s => {;;; setTimeout(() => {; s.complete(); }, 1000); }); } <p *ngFor=”let item of observablesEx01() | async”>{{item}}</p> End getting: error TS2322: Type ‘number | null’ is not assignable to type ‘NgIterable | null […]

By NestorArturo
Categorized as angular, observable, rxjs, templates Tagged , , ,

Why do I get an ‘undefined’ error in regards to the data in my Angular template?

I’m trying to create a template in my Angular 11 application but it’s not recognizing the data inside it. We have a Kendo grid, and we want the first column to consist of a button that brings up a menu when clicked. So I created a component to function as the button and the menu: […]

By gib65
Categorized as angular, components, kendo-grid, templates Tagged , , ,

AngularJS: Using $templateCache to customize ui-select template

I want to customize ui-select template in certain places, So I am overriding it using templateCache like below example. ($templateCache) { ‘ngInject’; const templateName = ‘bootstrap/choices.tpl.html’; var template = $templateCache.get(templateName); template = template.replace("<span class="fa fa-minus"></span>", "<span class="fa fa-plus"></span>); $templateCache.put(templateName, template); }) The problem with above approach is it’s replacing the template in all ui-select […]

By MV reddy
Categorized as angularjs, caching, javascript, templates Tagged , , ,

Pattern matching in angular html template

Is there any way to apply pattern matching on HTML label other than using a pipe? <label>{{myString}}</label> Source: Angular Questions

By WebDeveloper21
Categorized as angular, html, templates Tagged , ,
1 7

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us