I am fetching data from SQL server through a back-end API in asp.net, and everything is going well I am fetching the data as well but it's not showing on the screen only in the console here is a picture to understand what I am trying to achieve
Here is my .service:
GetCategories(): Observable<any> {
return this.http.get<any>(this.BaseUrl);
// return this.afs.collection<any>('Categories').valueChanges();
}
and here is my .ts :
GetCategories() {
this.api.GetCategories().subscribe({
next: (Categ) => {
this.categories = Categ;
console.log(this.categories);
},
error: (err) => {
console.log(err);
},
});
}
and my .HTML :
<mat-form-field fxLayoutAlign="center center" (click)="GetCategories()">
<mat-label> Filter by Categories</mat-label>
<mat-select (selectionChange)="FilterCateg($event)">
<mat-option
*ngFor="let Categ of categories"
[value]="Categ.categories"
class="DropDown-color"
>
{{ Categ.categories }}
</mat-option>
</mat-select>
</mat-form-field>
From my experience it should be displaying but I don't know what I am doing wrong, thanks for help in advance.
Categ.categoriesis suspicious, sinceCategwill hold just one category. create a model interface, then you can get rid of theanys and have intellisense on your objects