I'm working with ng-select 2.0.0 in my project angular5 as in this link , i can get results from the api rest spring boot but i'm fascing a problem i get this error while i click on ng-select :
ERROR TypeError: Object(...) is not a function
at NgDropdownPanelComponent.ngOnInit (ng-select.js:1450)
at checkAndUpdateDirectiveInline (core.js:12352)
at checkAndUpdateNodeInline (core.js:13876)
and also i can't select the information ( in this case attribute 'nom') i want , it's like the ng select is blocked or somthing like this .
this is my code for project.component.html
<ng-select *ngIf="_listClients"
[items]="listClient"
bindLabel ="nom"
bindValue ="id"
[(ngModel)]="selectedPersonId">
</ng-select>
<p>
Selected city ID: {{selectedPersonId | json}}
</p>
This is the file project.component.ts
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {ProjetService} from '../../../../../service/projet.service';
import {Projet} from '../../Models/Projet';
import { ModalDirective } from 'ngx-bootstrap/modal';
import 'rxjs/add/operator/map';
import {ClientService} from '../../../../../service/client.service';
@Component({
selector: 'app-projects',
templateUrl: './projects.component.html',
styleUrls: ['./projects.component.scss']
})
export class ProjectsComponent implements OnInit {
selectedPersonId:number = null;
_listClients :any;
constructor(private router:Router,
private projetSevice:ProjetService,
private clientServ:ClientService,
private route: ActivatedRoute) { }
ngOnInit() {
this.clientList();
}
get listClient() {
return this._listClients ? this._listClients.map(item => {
return {id: item.id, prenom : item.prenom , nom : item.nom}
}) : [];
}
clientList(){
this.clientServ.getListClients()
.subscribe((data:any)=>{
this._listClients=data;
},err=>{
console.log('this is error ');
})
}
}
Any help ?
npm uninstall @ng-select/ng-selectthemnpm i -s @ng-select/[email protected]