MCPcopy
hub / github.com/angular/components / MatChipGrid

Class MatChipGrid

src/material/chips/chip-grid.ts:79–532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77 encapsulation: ViewEncapsulation.None,
78})
79export class MatChipGrid
80 extends MatChipSet
81 implements
82 AfterContentInit,
83 AfterViewInit,
84 ControlValueAccessor,
85 DoCheck,
86 MatFormFieldControl<any>,
87 OnDestroy
88{
89 ngControl = inject(NgControl, {optional: true, self: true})!;
90
91 /**
92 * Implemented as part of MatFormFieldControl.
93 * @docs-private
94 */
95 readonly controlType: string = 'mat-chip-grid';
96
97 /** The chip input to add more chips */
98 protected _chipInput?: MatChipTextControl;
99
100 protected override _defaultRole = 'grid';
101 private _errorStateTracker: _ErrorStateTracker;
102 private _uid = inject(_IdGenerator).getId('mat-chip-grid-');
103
104 /**
105 * List of element ids to propagate to the chipInput's aria-describedby attribute.
106 */
107 private _ariaDescribedbyIds: string[] = [];
108
109 /**
110 * Function when touched. Set as part of ControlValueAccessor implementation.
111 * @docs-private
112 */
113 _onTouched = () => {};
114
115 /**
116 * Function when changed. Set as part of ControlValueAccessor implementation.
117 * @docs-private
118 */
119 _onChange: (value: any) => void = () => {};
120
121 /**
122 * Implemented as part of MatFormFieldControl.
123 * @docs-private
124 */
125 @Input({transform: booleanAttribute})
126 override get disabled(): boolean {
127 return this.ngControl ? !!this.ngControl.disabled : this._disabled;
128 }
129 override set disabled(value: boolean) {
130 this._disabled = value;
131 this._syncChipsState();
132 this.stateChanges.next();
133 }
134
135 /**
136 * Implemented as part of MatFormFieldControl.

Callers

nothing calls this directly

Calls 1

getIdMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…