Linked Questions

52 votes
3 answers
12k views

Dynamic Component selection in Angular2 [duplicate]

Given a model for a page section which contains multiple fields and would be populated with data such like this: { "fields": [ { "id": 1, "type": "text", ...
DannyMeister's user avatar
  • 1,312
2 votes
1 answer
1k views

Store Angular2 components in a list and render each component in a template [duplicate]

So i have a list of cards (using ionic2), and each card can be one of a number of different types. I was hoping to encapsulate each card in its own component, store them in a list and render them in ...
Jason Wall's user avatar
3 votes
0 answers
557 views

Angular2, loading components dynamically on demand in tabs [duplicate]

At the end of my wits here, so reaching out to smarter people. I am building a custom "tabbed" CMS system. Problem is with tabs and components. I wish to show a specific component in newly generated ...
Starwave's user avatar
  • 2,444
0 votes
0 answers
549 views

How to inject component tag using innerHTML directive? [duplicate]

I have some collection of objects, in which each object has the following property: { ... component: '<example-component></example-component>' } And in my *ngFor directive, I have the ...
uksz's user avatar
  • 18.4k
0 votes
0 answers
117 views

Angular 2 dynamic component creation [duplicate]

UPDATE: I just had a look at the wrong Plunkr, this Plunkr seems to fit my usecase: http://plnkr.co/edit/GJTLrnQdRDBvZenX59PZ?p=preview I want to dynamically create components, for example I have the ...
B zum S's user avatar
  • 258
3 votes
0 answers
91 views

rendering a list of components in ngFor angular2 [duplicate]

I have an array of IAnimal with components like dog cat each has its own properties and extends the IAnimal Interface. Now I want to render all the components in a *ngFor loop from my IAnimal Array ...
Joe B's user avatar
  • 808
228 votes
16 answers
197k views

How can I use/create dynamic template to compile dynamic Component with Angular 2.0?

I want to dynamically create a template. This should be used to build a ComponentType at runtime and place (even replace) it somewhere inside of the hosting Component. Until RC4 I was using ...
Radim Köhler's user avatar
166 votes
7 answers
127k views

What is entryComponents in angular ngModule?

I am working on an Ionic app ( 2.0.0-rc0 ) which depends on angular 2 . So the new introduction of ngModules is included. I am adding my app.module.ts. below. import { NgModule } from '@angular/core';...
raj's user avatar
  • 6,124
146 votes
9 answers
78k views

Equivalent of $compile in Angular 2

I want to manually compile some HTML containing directives. What is the equivalent of $compile in Angular 2? For example, in Angular 1, I could dynamically compile a fragment of HTML and append it ...
Michael Kang's user avatar
85 votes
2 answers
117k views

Dynamically ADDING and REMOVING Components in Angular

The current official docs only shows how to dynamically change components within an <ng-template> tag. https://angular.io/guide/dynamic-component-loader What I want to achieve is, let's say I ...
Marcellino Corleone's user avatar
34 votes
5 answers
51k views

Can component invoke a self destroy event

I have a parent component which opens a new component on click of a link, this new component is supposed to have a close button which on close sends a closing message to parent and destroy itself. We ...
Sumit Agarwal's user avatar
58 votes
4 answers
77k views

How to place a dynamic component in a container

I want to create dynamic components and insert views of these components to a container. I think this can be achieved by ViewContainerRef. But I don't know, can we get ViewContainerRef of any ...
Prem Parihar's user avatar
  • 1,070
29 votes
7 answers
63k views

Angular 2 innerHTML (click) binding

I had such a large html menu that I decided to binding to be able to make several submenu dropdown and avoid html code duplication. Parent > child (which is parent too) > child... For the context : ...
Paul Leclerc's user avatar
  • 1,137
39 votes
5 answers
37k views

Angular2: Creating child components programmatically

Question How to create child components inside a parent component and display them in the view afterwards using Angular2? How to make sure the injectables are injected correctly into the child ...
Waog's user avatar
  • 7,305
23 votes
4 answers
24k views

Dynamically adding components in ngFor

I have a "dashboard" that loads configured elements. Dashboard template has this: <div class="dash-container" [ngGrid]="gridConfig"> <div *ngFor="let box of boxes; let i = index" ...
Agony's user avatar
  • 844

15 30 50 per page
1
2 3 4 5
17