Hi,
I'm facing the following problem, someone could help me?
MunicipioFormComponent.html:32 ERROR TypeError: Object(...) is not a function
at handleOptionChange (ng-select.js:2555)
at SafeSubscriber.ngOptions.changes.pipe.subscribe.options [as _next] (ng-select.js:2568)
at SafeSubscriber.__tryOrSetError (Subscriber.js:240)
at SafeSubscriber.next (Subscriber.js:181)
at Subscriber._next (Subscriber.js:122)
at Subscriber.next (Subscriber.js:86)
at TakeUntilSubscriber._next (Subscriber.js:122)
at TakeUntilSubscriber.next (Subscriber.js:86)
at MergeMapSubscriber.notifyNext (mergeMap.js:132)
at InnerSubscriber._next (InnerSubscriber.js:16)
And this is my html page:
<div class="form-group required" formGroupName="uf">
<label class="control-label" for="uf">UF</label>
<ng-select formControlName="id" [items]="ufList" bindLabel="descricao" bindValue="id" [(ngModel)]="municipio.uf.id">
</ng-select>
</div>
MunicipioFormComponent.ts
ufList: Array<UF> = new Array<UF>();
ngOnInit() {
this.ufService.search().subscribe((data) => {
this.ufList = data['data'];
});
this.form = this.formBuilder.group({
id: ['', []],
nome: ['', [Validators.required]],
codigoMunicipal: ['', [
Validators.required,
Validators.minLength(7),
Validators.maxLength(7),
Validators.pattern('[0-9]+')
]],
uf: this.formBuilder.group({
id: ['', [Validators.required]]
}),
pais: this.formBuilder.group({
id: ['', [Validators.required]]
})
});
}
Thanks!
@danilocgraciano you don't need to use ngModel with reactive forms, this probably causes the issue.
Hi, thank you for your help. But the real problem was my array "ufList" was not been converted into a NgOption Array.
Right now, i'm facing the same problem described here https://github.com/ng-select/ng-select/issues/548
please create reproducible example
I am also having the same issue as above. I will try to create a reproducible example. It was working under ng-select 1.xxx and I upgraded to 2.0 with the rxjs compatible package