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

Method add

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

Source from the content-addressed store, hash-verified

1218 addOnBlur: boolean = true;
1219
1220 add(event: MatChipInputEvent): void {
1221 const value = (event.value || '').trim();
1222
1223 // Add our foods
1224 if (value) {
1225 this.foods.update(current => [
1226 ...current,
1227 {
1228 value: `${value.toLowerCase()}-${current.length}`,
1229 viewValue: value,
1230 },
1231 ]);
1232 }
1233
1234 // Reset the input value
1235 event.chipInput!.clear();
1236 }
1237
1238 remove(food: any): void {
1239 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