Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
899 stars 360 forks source link

add `afterAdd` item event #922

Closed weilinzung closed 4 years ago

weilinzung commented 4 years ago

Does this have an option to detect if one item valid added? I am looking for disabling a submit button before an item converted to a tag. I am guessing it is called a race condition, so the better way is to disable the submit button.

With onFocus & onBlur, I can create events to disable the submit button, but it can not detect if one valid tag success added then enable the button, I have to click outside of the tag input field.

<button [disabled]=isFocus" mat-raised-button color="primary">Submit</button>

  onInputFocused($event: string) {
    this.isFocus = true;
  }

  onInputBlurred($event: string) {
    this.isFocus = false
  }

Also, if with onFocus & onAdd, it would not work as what I am looking for.

So it would be great if we have afterAdd option.