Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laudebugs/dynamic-components-angular

Angular Starter App with Angular Material
https://github.com/laudebugs/dynamic-components-angular

angular angularmaterial

Last synced: 5 days ago
JSON representation

Angular Starter App with Angular Material

Awesome Lists containing this project

README

        

# Dynamic Components in Angular

> A repository to demonstrate the use of dynamic components in Angular

[Read referenced article here](https://www.laudebugs.me/dev/dynamic-components-angular)
[Stackblitz](https://stackblitz.com/edit/angular-ivy-lzyecr)

## Glossary

### `ViewContainerRef`

A reference to the container where one or more views can be attached.
[Reference](https://angular.io/api/core/ViewContainerRef)

### `@ViewChild`

A property decorator that configures a view query.
[Reference](https://angular.io/api/core/ViewChild)

## Directives

### `movieHost`

Directive to anchor where to host the dynamic component.

```ts
import { Directive, ViewContainerRef } from '@angular/core'

@Directive({ selector: '[movieHost]' })
export class MovieHostDirective {
constructor(private viewContainerRef: ViewContainerRef) {}
}
```