@angular/material/chips#MatChipInputEvent TypeScript Examples

The following examples show how to use @angular/material/chips#MatChipInputEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: emote-create.component.ts    From App with MIT License 6 votes vote down vote up
addTag(ev: MatChipInputEvent): void {
		if (ev.value.length < 3 || this.tags.length > 5) {
			ev.chipInput?.clear();
			return undefined;
		}

		this.tags.push(ev.value.toLowerCase());
		ev.chipInput?.clear();
	}
Example #2
Source File: basic-info-form.component.ts    From careydevelopmentcrm with MIT License 6 votes vote down vote up
addTag(event: MatChipInputEvent): void {
    const input = event.input;
    const value = event.value;

    if ((value || '').trim()) {
      if (value.length < 21) {
        this.basicInfoFormGroup.controls['tags'].setValue([...this.basicInfoFormGroup.controls['tags'].value, value.trim()]);
        this.basicInfoFormGroup.controls['tags'].updateValueAndValidity();
      }
    }

    // Reset the input value
    if (input) {
      input.value = '';
    }
  }
Example #3
Source File: list-edit.component.ts    From attack-workbench-frontend with Apache License 2.0 6 votes vote down vote up
/** Add value to object property list */
    public add(event: MatChipInputEvent): void {
        if (event.value && event.value.trim()) {
            this.config.object[this.config.field].push(event.value.trim());
            this.inputControl.setValue(this.config.object[this.config.field]);
        }
        if (event.input) {
            event.input.value = ''; // reset input value
        }
    }
Example #4
Source File: json-schema-form.component.ts    From json-schema-form with Apache License 2.0 6 votes vote down vote up
/**
   * new chip entered
   */
  addChip(event: MatChipInputEvent): void {
    const input = event.input;
    const value = event.value;

    // Add our fruit
    if ((value || '').trim()) {
      if (!this.value) { this.value = []; }
      this.value.push(value.trim());
      this.emit(this.value);
    }

    // Reset the input value
    if (input) {
      input.value = '';
    }
  }
Example #5
Source File: edit-workflow.component.ts    From workflow-editor with Educational Community License v2.0 6 votes vote down vote up
addTag(event: MatChipInputEvent) {
    const input = event.input;
    const value = event.value;

    if ((value || '').trim()) {
      if (this.workflow.tags === undefined) { this.workflow.tags = []; }
      this.workflow.tags.push({value: value.trim()});
    }

    // Reset the input value
    if (input) {
      input.value = '';
    }

    this.tagCtrl.setValue(null);
  }
Example #6
Source File: edit-workflow.component.ts    From workflow-editor with Educational Community License v2.0 6 votes vote down vote up
addRole(event: MatChipInputEvent) {
    const input = event.input;
    const value = event.value;

    if ((value || '').trim()) {
      if (this.workflow.roles === undefined) { this.workflow.roles = []; }
      this.workflow.roles.push({value: value.trim()});
    }

    // Reset the input value
    if (input) {
      input.value = '';
    }

    this.roleCtrl.setValue(null);
  }
Example #7
Source File: module-config.ts    From 6PG-Dashboard with MIT License 6 votes vote down vote up
// input events

    add(event: MatChipInputEvent, array: any[]) {        
        const { value, input } = event;
    
        if ((value || '').trim())
          array.push(value.trim());
    
        if (input) 
          input.value = '';

        this.openSaveChanges();
    }
Example #8
Source File: autocomplete-chip.component.ts    From matx-angular with MIT License 6 votes vote down vote up
add(event: MatChipInputEvent): void {
    // Add fruit only when MatAutocomplete is not open
    // To make sure this does not conflict with OptionSelected Event
    if (!this.matAutocomplete.isOpen) {
      const input = event.input;
      const value = event.value;

      // Add our fruit
      if ((value || '').trim()) {
        this.fruits.push(value.trim());
      }

      // Reset the input value
      if (input) {
        input.value = '';
      }

      this.fruitCtrl.setValue(null);
    }
  }
Example #9
Source File: input-chip.component.ts    From matx-angular with MIT License 6 votes vote down vote up
add(event: MatChipInputEvent): void {
    const input = event.input;
    const value = event.value;

    // Add our fruit
    if ((value || '').trim()) {
      this.fruits.push({name: value.trim()});
    }

    // Reset the input value
    if (input) {
      input.value = '';
    }
  }
Example #10
Source File: approver-dialog.component.ts    From fyle-mobile-app with MIT License 5 votes vote down vote up
addChip(event: MatChipInputEvent) {
    if (event && event.chipInput) {
      event.chipInput.clear();
    }
    this.clearValue();
  }
Example #11
Source File: fy-multiselect-modal.component.ts    From fyle-mobile-app with MIT License 5 votes vote down vote up
addChip(event: MatChipInputEvent) {
    if (event && event.chipInput) {
      event.chipInput.clear();
    }
  }
Example #12
Source File: fy-userlist-modal.component.ts    From fyle-mobile-app with MIT License 5 votes vote down vote up
addChip(event: MatChipInputEvent) {
    if (event && event.chipInput) {
      event.chipInput.clear();
    }
  }