"categorie.forEach is not a function"

I’m trying to display this.cat in a dropdown but I get this error :

categorie.forEach is not a function

This is my code :

   getCategories(){     this.policeService.getCategoriesList().subscribe(       data => {       this.categories=data;       console.log(this.categories);       },      error =>       console.log(error));   }  changeCategories() {     this.sourceCategories.length = 0;     this.categories.forEach((categorie) => {         categorie.forEach((categorie) => this.brancheid = categorie.branche.id);          if(this.policeform.get("branche").value.id == this.brancheid) {             this.sourceCategories.push(categorie);             this.cat = JSON.parse(JSON.stringify(this.sourceCategories));         }     }) } 

this is my categories list

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.