Okay so what I'm trying to do is I have an *ngFor
that populates with category names what I'm trying to do is get the one the user clicked on and then making an API call with it but when I click the button nothing happens. Is there a way to pass the const
to my api.service
or is the way I'm doing it in the component the only way to achieve this.
section: string;
sectionlink(text: any): void {
this.section = text;
const endpointlist = 'https://api.nytimes.com/svc/books/v3/lists/{{this.section}}?api-key=my-key-here';
return this.http.get<Listmodel[]>(endpointlist);
console.log(this.section);
}
<li class="uk-active"><button (click)="sectionlink(section.list_name)">{{section.list_name}}</button></li>