ngx-chips: TypeError: this._onChangeCallback is not a function

I’m submitting a … (check one with “x”)

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

Notice: feature requests will be ignored, submit a PR if you'd like

Current behavior I’m trying to use ngx to implement the tag systems. When entering the page everything happens as expected and no error is noticed on the console.

But when I do some kind of action, adding a new tag, editing, deleting or something with my tag-input field, the following error appears in the console:

ERROR TypeError: this._onChangeCallback is not a function at TagInputComponent.set [as items] (ngx-chips.bundle.js:2823) at TagInputComponent._this.appendTag (ngx-chips.bundle.js:1909) at SafeSubscriber.subscribeFn [as _next] (ngx-chips.bundle.js:2186) at SafeSubscriber.__tryOrSetError (ngx-chips.bundle.js:568) at SafeSubscriber.next (ngx-chips.bundle.js:510) at Subscriber._next (ngx-chips.bundle.js:448) at Subscriber.next (ngx-chips.bundle.js:412) at FilterSubscriber._next (ngx-chips.bundle.js:3807) at FilterSubscriber.Subscriber.next (ngx-chips.bundle.js:412) at MapSubscriber._next (ngx-chips.bundle.js:4059)

Expected behavior The expectation is that it works without throwing an error on the console.

Minimal reproduction of the problem with instructions (if applicable) 1. Added to tag to line.component.html <tag-input [(ngModel)]='items' [editable]='true'></tag-input> 2. Import TagInputModule in my register.module.ts import { TagInputModule } from 'ngx-chips'; 3. Import BrowserAnimationsModule in my app.module.ts imports: [ CommonModule, BrowserAnimationsModule, HttpModule, FormsModule, AppRoutingModule, BsDropdownModule.forRoot(), TabsModule.forRoot(), ChartsModule ]

What do you use to build your app?. Please specify the version Angular Cli version 1.2.0

Angular version: @angular/cli: 1.2.0, node: 6.11.1, os: linux x64, @angular/animations: 4.3.3, @angular/common: 4.2.5, @angular/compiler: 4.2.5, @angular/core: 4.2.5, @angular/forms: 4.2.5, @angular/http: 4.2.5, @angular/platform-browser: 4.2.5, @angular/platform-browser-dynamic: 4.2.5, @angular/router: 4.2.5, @angular/upgrade: 4.2.5, @angular/cli: 1.2.0, @angular/compiler-cli: 4.2.5

ngx-chips version: version 1.5.0

Browser: [Chrome]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 31 (15 by maintainers)

Most upvoted comments

@renanmoraes Add the operator “first” in the same way you imported those ones

import 'rxjs/add/operator/first';

and you should not be pushing to items, ngModel takes care of that. onAdding will just replace the value that will be added

Try upgrading to 4,3,0 all the angular packages

Are you defining any model? That’s what that error usually say. Either no ngmodel or no form control name. Check the examples

Have you set formControlName or ngmodel?

You need to intercept the value and transform it. Check out the onAdding property. Remember you need to send an observable, so read the example carefully

Looks like you’re not importing ReactiveFormsModule