/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/material/tree/tree.ts
36 строк
1 KB
Kristiyan Kostadinov
fix(multiple): use eager change detection
27 фев 2026, 00:40
27 фев 2026, 00:40
936f114
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {CdkTree} from '@angular/cdk/tree'; import {ChangeDetectionStrategy, Component, ViewChild, ViewEncapsulation} from '@angular/core'; import {MatTreeNodeOutlet} from './outlet'; /** * Wrapper for the CdkTable with Material design styles. */ @Component({ selector: 'mat-tree', exportAs: 'matTree', template: `<ng-container matTreeNodeOutlet></ng-container>`, host: { 'class': 'mat-tree', }, styleUrl: 'tree.css', encapsulation: ViewEncapsulation.None, // See note on CdkTree for explanation on why this uses the default change detection strategy. // tslint:disable-next-line:validate-decorators changeDetection: ChangeDetectionStrategy.Eager, providers: [{provide: CdkTree, useExisting: MatTree}], imports: [MatTreeNodeOutlet], }) export class MatTree<T, K = T> extends CdkTree<T, K> { // Outlets within the tree's template where the dataNodes will be inserted. // We need an initializer here to avoid a TS error. The value will be set in `ngAfterViewInit`. @ViewChild(MatTreeNodeOutlet, {static: true}) override _nodeOutlet: MatTreeNodeOutlet = undefined!; }