Questions tagged [ng-template]
267 questions
81
votes
2 answers
Angular - ng-template with parameter inside ngIf inside ngFor
I am trying to build this template:
...
{{…
![](../../users/profiles/845611.webp)
yanivps
- 1,359
- 2
- 18
- 30
55
votes
1 answer
why *ngIf doesnt'work with ng-template?
I have a condition in the template as follows:
Section {{seat?.section}} , …
user7426734
49
votes
3 answers
What is $implicit in angular 2?
How is the following keyword used in angular2 ng-templates
What is the purpose of $implicit in angular 2 templates?
What is relationship between let- and $implicit?
![](../../users/profiles/5471129.webp)
Mantu Nigam
- 2,593
- 4
- 20
- 38
34
votes
4 answers
What are practical scenarios of *ngTemplateOutlet directive?
I was reading about *ngTemplateOutlet directive. The use of this directive is to instantiate a template dynamically by a template reference and context object as parameters.
What I want to know is that we have so many things in Angular to achieve…
![](../../users/profiles/3298390.webp)
patrick.1729
- 2,752
- 2
- 15
- 23
20
votes
2 answers
How to include an ng-template element without a condition in Angular 2
I need an HTML fragment more than once in my Angular template. Instead of writing the HTML code multiple times, I decided to put it inside an ng-template element and use that element replicated in the code.
For example:
…
![](../../users/profiles/7346048.webp)
user7346048
- 650
- 8
- 15
19
votes
5 answers
Passing ngFor variable to an ngIf template
How do I pass the current variable in an ngFor loop to ngIf, if it is using templates with then/else syntax?
It appears that they pass through fine when used inline, but aren't accessible from a template, for example:
- 5,496
- 1
- 15
- 32
![](../../users/profiles/9203110.webp)
match
19
votes
2 answers
Open ng-bootstrap modal programmatically
I've got an angular 4 page including a ng-bootstrap modal. My code looks like this.
foo.html
[...]
…
![](../../users/profiles/4243929.webp)
Christian Riese
- 535
- 1
- 4
- 15
14
votes
5 answers
angular2 ng-template in a separate file
angular2 how to use ng-template from a different file? When I place the ng-template within the same HTML where I use it works but when I move ng-template into a separate file then it won't work. Is there a way to move ng-template into its own file…
![](../../users/profiles/2742156.webp)
Pratap A.K
- 3,816
- 6
- 36
- 72
13
votes
2 answers
Angular pass a Component as ng-template of another Component
In my Angular 6 app I need to pass a Component to another Component as its ng-template.
The reason is that I have a Component A that I need to replicate many times, but each time it has to include different components (let's call them Component B…
![](../../users/profiles/3497671.webp)
Francesco Borzi
- 37,945
- 31
- 126
- 195
12
votes
3 answers
Function inside a template is called many times (Angular JS)
Today I had to fix a performance issue caused by this code: Pay attention to updateStats called inside the template