Notice: file_put_contents(): Write of 17022 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50
Frontender Libs - обзор библиотек JS / CSS@sWebDev P.3155
SWEBDEV Telegram 3155
Динамическая загрузка компонентов с использованием возможностей Angular Ivy

Одним из нововведений в Angular с появлением Ivy является возможность динамической загрузки компонентов. Ранее этот процесс требовал использования ComponentFactoryResolver. С Ivy же, динамическая загрузка компонентов стала проще и интуитивно понятнее.

Пример:

Для динамической загрузки компонентов мы можем использовать метод ViewContainerRef.createComponent. Он позволяет загружать компоненты по мере необходимости, не загружая их в основной бандл приложения.
import { Component, ViewChild, ViewContainerRef } from '@angular/core';

@Component({
selector: 'app-dynamic-loader',
template: `<ng-template #container></ng-template>`
})
export class DynamicLoaderComponent {
@ViewChild('container', { read: ViewContainerRef, static: true }) container: ViewContainerRef;

constructor() {}

loadComponent(component: any) {
this.container.clear();
this.container.createComponent(component);
}
}

👉 @sWebDev
👍4👎1



tgoop.com/sWebDev/3155
Create:
Last Update:

Динамическая загрузка компонентов с использованием возможностей Angular Ivy

Одним из нововведений в Angular с появлением Ivy является возможность динамической загрузки компонентов. Ранее этот процесс требовал использования ComponentFactoryResolver. С Ivy же, динамическая загрузка компонентов стала проще и интуитивно понятнее.

Пример:

Для динамической загрузки компонентов мы можем использовать метод ViewContainerRef.createComponent. Он позволяет загружать компоненты по мере необходимости, не загружая их в основной бандл приложения.

import { Component, ViewChild, ViewContainerRef } from '@angular/core';

@Component({
selector: 'app-dynamic-loader',
template: `<ng-template #container></ng-template>`
})
export class DynamicLoaderComponent {
@ViewChild('container', { read: ViewContainerRef, static: true }) container: ViewContainerRef;

constructor() {}

loadComponent(component: any) {
this.container.clear();
this.container.createComponent(component);
}
}

👉 @sWebDev

BY Frontender Libs - обзор библиотек JS / CSS




Share with your friend now:
tgoop.com/sWebDev/3155

View MORE
Open in Telegram


Telegram News

Date: |

Unlimited number of subscribers per channel In the next window, choose the type of your channel. If you want your channel to be public, you need to develop a link for it. In the screenshot below, it’s ”/catmarketing.” If your selected link is unavailable, you’ll need to suggest another option. Telegram has announced a number of measures aiming to tackle the spread of disinformation through its platform in Brazil. These features are part of an agreement between the platform and the country's authorities ahead of the elections in October. Some Telegram Channels content management tips So far, more than a dozen different members have contributed to the group, posting voice notes of themselves screaming, yelling, groaning, and wailing in various pitches and rhythms.
from us


Telegram Frontender Libs - обзор библиотек JS / CSS
FROM American