Linked Questions
12 questions linked to/from Creating an angular2 component with ng-content dynamically
0 votes
0 answers
181 views
Dynamically Load NgContent in Angular2+ Component [duplicate]
I am using Angular2 Dart 3.1.0. I am dynamically loading a component, and I want to know if there is a way to input what would go into <ng-content></ng-content>. I am dynamically loading a ...
0 votes
0 answers
56 views
Nest two dynamically created components in Angular [duplicate]
In React, I could easily do the following to nest two components whose actual type was not known until runtime, and whose class types were supplied as props: render() { const FirstComponent = this....
14 votes
1 answer
8k views
Angular structural directive: wrap the host element with some another component
I have simplest Angular structural directive: import { Directive, TemplateRef, ViewContainerRef } from '@angular/core'; @Directive({ selector: '[hello]' }) export class HelloDirective { ...
5 votes
2 answers
6k views
Angular 4 ngComponentOutlet loads dynamic components, but route content is not being rendered
I'm trying to load different 'parent' components and inject route content into these different parent components by targeting ng-content in each parent component. Essentially, each parent component ...
7 votes
1 answer
3k views
Why is projectableNodes an any[][]?
I've played around with ViewContainerRef.createComponent and I'm wondering why the parameter projectableNodes is an any[][]. Unfortunatelly, this parameter hasn't been documented so far. What to ...
3 votes
1 answer
3k views
Custom ngIf directive with embedded else template
It's a common pattern in Angular apps to display some data coming from Observable with ngIf directive and provide else template to show placeholder while data is loading. <data-view *ngIf="data$ | ...
1 vote
1 answer
4k views
angular dynamic component with nested components
I am building an app that is basically a e-book. Each page has the same outer formatting with unique content which is defined using HTML and custom components. The outer page is defined as: <...
0 votes
1 answer
2k views
Add child component to parent component and add parent to document
In an Angular 7 modal service I am creating a modal Stackblitz. The modal is simply a DIV added to document as follows: const modal = document.createElement('div'); modal.classList.add('modal'); ...
0 votes
1 answer
2k views
Toggle multiple side navs in angular 4
My component structure is app --app.component.html --app.component.ts -dashboard --dashboard.component.html --dashboard.component.ts -sales --sales.component.html --sales....
1 vote
0 answers
1k views
Dynamically add components to tabs angular 2
The goal is to dynamically load components from a list and display them with their associated tab. My approach for making tabs is a based off of the this tutorial: https://juristr.com/blog/2016/02/...
0 votes
1 answer
779 views
Angular 5: How to embed a component into another
imagine, I have a generic table component with expandable rows and I need to inject another dynamic content (a dynamic SVG in this case) into this expandable rows from within a component, that uses ...
5 votes
0 answers
574 views
Create Component with Dynamic Directives
We are currently using the ViewContainerRef.createComponent() method to generate components dynamically at runtime - it's sort of a plugin system, where the user can add plugins and display screens as ...