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

Method add

src/material/chips/chip-grid.spec.ts:1207–1223  ·  view source on GitHub ↗
(event: MatChipInputEvent)

Source from the content-addressed store, hash-verified

1205 addOnBlur: boolean = true;
1206
1207 add(event: MatChipInputEvent): void {
1208 const value = (event.value || '').trim();
1209
1210 // Add our foods
1211 if (value) {
1212 this.foods.update(current => [
1213 ...current,
1214 {
1215 value: `${value.toLowerCase()}-${current.length}`,
1216 viewValue: value,
1217 },
1218 ]);
1219 }
1220
1221 // Reset the input value
1222 event.chipInput!.clear();
1223 }
1224
1225 remove(food: any): void {
1226 const index = this.foods().indexOf(food);

Callers 15

_toggleVisibilityMethod · 0.45
constructorMethod · 0.45
ngAfterViewInitMethod · 0.45
_initializeControlMethod · 0.45
activateMethod · 0.45
deactivateMethod · 0.45
ngAfterViewInitMethod · 0.45
constructorMethod · 0.45
_setContainerClassMethod · 0.45
_transitionCheckStateMethod · 0.45
checkbox.spec.tsFile · 0.45
ngAfterViewInitMethod · 0.45

Calls 2

updateMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected