SWEBDEV Telegram 2889
Управление элементами DOM

@ViewChildren и @ContentChildren - это декораторы Angular, используемые для доступа к дочерним компонентам.

Ключевое отличие:

@ViewChildren предоставляет доступ к дочерним компонентам, которые напрямую определены в шаблоне, и изменения отражаются немедленно.

@ContentChildren обеспечивает доступ к дочерним компонентам, которые проецируются из родительского компонента, и изменения не отражаются до завершения проекции.

Пример:
@Component({
selector: 'app-parent',
template: `<ul *ngFor="let child of children">{{ child.name }}</ul>`
})
export class ParentComponent {
@ViewChildren('viewChildren') children: QueryList<ChildComponent>;
}

@Component({
selector: 'child-component',
template: `<p>{{ name }}</p>`
})
export class ChildComponent {
name = 'Child';
}

👉 @sWebDev
👍6🔥1



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

Управление элементами DOM

@ViewChildren и @ContentChildren - это декораторы Angular, используемые для доступа к дочерним компонентам.

Ключевое отличие:

@ViewChildren предоставляет доступ к дочерним компонентам, которые напрямую определены в шаблоне, и изменения отражаются немедленно.

@ContentChildren обеспечивает доступ к дочерним компонентам, которые проецируются из родительского компонента, и изменения не отражаются до завершения проекции.

Пример:

@Component({
selector: 'app-parent',
template: `<ul *ngFor="let child of children">{{ child.name }}</ul>`
})
export class ParentComponent {
@ViewChildren('viewChildren') children: QueryList<ChildComponent>;
}

@Component({
selector: 'child-component',
template: `<p>{{ name }}</p>`
})
export class ChildComponent {
name = 'Child';
}

👉 @sWebDev

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




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

View MORE
Open in Telegram


Telegram News

Date: |

When choosing the right name for your Telegram channel, use the language of your target audience. The name must sum up the essence of your channel in 1-3 words. If you’re planning to expand your Telegram audience, it makes sense to incorporate keywords into your name. ‘Ban’ on Telegram Matt Hussey, editorial director of NEAR Protocol (and former editor-in-chief of Decrypt) responded to the news of the Telegram group with “#meIRL.” Activate up to 20 bots Over 33,000 people sent out over 1,000 doxxing messages in the group. Although the administrators tried to delete all of the messages, the posting speed was far too much for them to keep up.
from us


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