I'm trying to display data fetched from laravel api in angular table code is :
public function fetchQuestions(Request $request)
{
$questions = Questions::where('status',$request->status)->get();
return response()->json($questions, 200);
}
angular code:
questions = [];
...
this.http.post(this.baseUrl+'api/auth/question', formData).subscribe(result => {
this.questions.push(result);
This does not display any data
i have to use
this.questions.push(result[0]);
this.questions.push(result[1]);
..
..
this.questions.push(result[n]);
to push all the data. How can i push all array data.
and display data using loop
<ng-container *ngFor="let img of questions; let i=index">
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire