MCPcopy Create free account
hub / github.com/angular/components / ngOnInit

Method ngOnInit

src/aria/tree/tree-item.ts:129–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127 }
128
129 ngOnInit() {
130 if (this.parent() instanceof TreeItemGroup) {
131 (this.parent() as TreeItemGroup<V>)._register(this);
132 }
133 this.tree()._collection.register(this);
134
135 const treePattern = computed(() => this.tree()._pattern);
136 const parentPattern = computed(() => {
137 if (this.parent() instanceof Tree) {
138 return treePattern();
139 }
140 return (this.parent() as TreeItemGroup<V>).ownedBy()._pattern;
141 });
142 this._pattern = new TreeItemPattern<V>({
143 ...this,
144 tree: treePattern,
145 parent: parentPattern,
146 children: computed(() => this._group()?._childPatterns()),
147 hasChildren: computed(() => !!this._group()),
148 element: () => this.element,
149 searchTerm: () => this.searchTerm() ?? '',
150 });
151 }
152
153 ngOnDestroy() {
154 if (this.parent() instanceof TreeItemGroup) {

Callers

nothing calls this directly

Calls 4

computedFunction · 0.85
parentMethod · 0.80
_registerMethod · 0.45
registerMethod · 0.45

Tested by

no test coverage detected