Top "Ng-template" questions

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 …

angular typescript angular-components ng-template
Dynamic template based on value rather than variable with ngTemplateOutlet

I'm trying to mock up a dynamic set of questions. Think of a quiz, where one question is multiple choice, …

angular ng-template
Angular 2 ng-template not rendering in dom inside component

I have a component like so import {Component, OnInit} from '@angular/core'; import {NgbModal, ModalDismissReasons} from '@ng-bootstrap/ng-bootstrap'; @…

angular ng-template
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 …

angular typescript ng-template
How to dynamically add a cloned node in angular2 (equivalent to cloneNode)

In Angular2, I need to duplicate a node rather than moving it in some cases. That node has angular2 properties …

angular dom clonenode ng-template
Angular 4 Dynamic form with nested groups

I want to generate a reactive form from the tree structure. Here is the code that creates the form items (…

forms angular angular-reactive-forms ng-template ng-container
How to render nested ng-template

I have such nested ng-template structure. @Component({ selector: 'my-app', template: ` <list> <ng-template *ngFor="let item of Items" #…

angular ng-template
How to get ng-template innerHTML to component

I want to get the innerHTML of ng-template to my component. Something like HTML <my-comp [template]="myTemplate"></…

angular typescript ng-template
Structural directives, position tooltip

I have created a structural directive that displays a tooltip based on what is inside an ng-template, when I hover …

angular tooltip ng-template
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/…

angular ngfor angular-ng-if ng-template