Bk Razor
Bk Razor

Reputation: 1532

Want to get value out of angular2 ngfor button loop from async call

I have an async for loop from an observalble which is an object of an array. I want to know how can I get the value out of this array when the button is clicked?

The object of array is like this: { topics: [ "first choice", "second choice", "third choice" ] }

<button *ngFor = "let choice of (choices | async)?.Topics">
{{question}}

Upvotes: 1

Views: 978

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657761

<button *ngFor = "let choice of (choices | async)?.Topics" 
    (click)="clickHandler(choice)">

Upvotes: 1

Related Questions