I am encountering an issue with the method below that updates the modules array. Even though the console displays the result correctly, the ng-select does not update the list accordingly. I attempted to use this.modules=[...elements]
, but it did not work either.
public updateModules(event) {
this.moduleService.retrieveModulesByLevel(this.form.get("levels").value).subscribe((data: any[]) => {
let elements = data.filter(module => module.assignClasses.some(item => event.map(el => el.classId).includes(item.classs.classId)));
this.modules = elements;
console.log(this.modules);
})
}
<ng-select [items]="modules" formControlName="module" bindLabel="designation" bindValue="moduleId"></ng-select>