Gbuomprisco / ngx-chips

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

formGroup usage on tag-input produces this._onTouchedCallback is not a function #952

Closed lemoncodes91 closed 4 years ago

lemoncodes91 commented 4 years ago

[x ] bug report => search github for a similar issue or PR before submitting [ ] support request/question

Current behavior 1.) Added [formGroup] to tag-intput

          <tag-input [onlyFromAutocomplete]="true"
                    [identifyBy]="'value'"
                    [displayBy]="'key'"
                    theme='bootstrap'
                    [formGroup]="filters" >
              <tag-input-dropdown [autocompleteObservable]="filterListObservable"
                                  zIndex="10000"
                                  [identifyBy]="'value'"
                                  [displayBy]="'key'"
                                  [keepOpen]="false"
                                  [showDropdownIfEmpty]="true"
                                  [appendToBody]="false">
              </tag-input-dropdown>
          </tag-input>
  1. Error occurs on console
    core.js:6185 ERROR TypeError: this._onTouchedCallback is not a function
    at TagInputComponent.onTouched (ngx-chips.js:359)
    at TagInputComponent.blur (ngx-chips.js:2008)
    at TagInputComponent_Template_tag_input_form_onBlur_3_listener (ngx-chips.js:2385)
    at executeListenerWithErrorHandling (core.js:21693)
    at wrapListenerIn_markDirtyAndPreventDefault (core.js:21735)
    at SafeSubscriber.schedulerFn [as _next] (core.js:36932)
    at SafeSubscriber.__tryOrUnsub (Subscriber.js:183)
    at SafeSubscriber.next (Subscriber.js:122)
    at Subscriber._next (Subscriber.js:72)
    at Subscriber.next (Subscriber.js:49)

Expected behavior 1.) No error should occur on console

Minimal reproduction of the problem with instructions (if applicable) 1.) add a [formGroup] to tag-input

What do you use to build your app?. Please specify the version Angular CLI: 9.0.7 Node: 12.16.1

Angular version: Angular 9.0.5

ngx-chips version: ngx-chips 2.1.0

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] Firefox 77.0.1 Note: Also using MS Edge (chrome based) - Version 83.0.478.61 for your FYI

lemoncodes91 commented 4 years ago

Using formcontrolname instead. seems that formgroup won't work