MCPcopy Index your code
hub / github.com/angular/components / _setNodeTypeIfUnset

Method _setNodeTypeIfUnset

src/cdk/tree/tree.ts:325–337  ·  view source on GitHub ↗

* Sets the node type for the tree, if it hasn't been set yet. * * This will be called by the first node that's rendered in order for the tree * to determine what data transformations are required.

(newType: 'flat' | 'nested')

Source from the content-addressed store, hash-verified

323 * to determine what data transformations are required.
324 */
325 _setNodeTypeIfUnset(newType: 'flat' | 'nested') {
326 const currentType = this._nodeType.value;
327
328 if (currentType === null) {
329 this._nodeType.next(newType);
330 } else if ((typeof ngDevMode === 'undefined' || ngDevMode) && currentType !== newType) {
331 console.warn(
332 `Tree is using conflicting node types which can cause unexpected behavior. ` +
333 `Please use tree nodes of the same type (e.g. only flat or only nested). ` +
334 `Current node type: "${currentType}", new node type "${newType}".`,
335 );
336 }
337 }
338
339 /**
340 * Switch to the provided data source by resetting the data and unsubscribing from the current

Callers 1

ngOnInitMethod · 0.80

Calls 2

warnMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected