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

Class MatChipGrid

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

getIdMethod · 0.45

Tested by

no test coverage detected