Am having a huge array in the below format which is returned from an API, I need to loop through it and display in the mobile app. Is there a way I can do this in angular2 ( am a newbie)
The reason why I am not using JSON format is because since the data is huge it returns no data when I run it in postman, hence am thinking to directly loop through an array in Ionic 3 framework and Angular2
Array
(
[0] => Array
(
[SubjectID] => 16
[QuestionID] => 4358
[QuestionType] =>
[Question] => Which one is a wrong statement?
[Answer1] => some answer1.
[Answer2] => some answer2
[Answer3] => some answer3
[Answer4] => some answer4
[CorrectAnswer] => 4
[Hint] =>
[DiffLevel] => Medium
[Status] => Active
[AnsDescription] => some description.
)
[1] => Array
(
[SubjectID] => 16
[QuestionID] => 4359
[QuestionType] => SingleAnswer
[QuestionType] =>
[Question] => Which one is a wrong statement?
[Answer1] => some answer1.
[Answer2] => some answer2
[Answer3] => some answer3
[Answer4] => some answer4
[CorrectAnswer] => 4
[Hint] =>
[DiffLevel] => Medium
[Status] => Active
[AnsDescription] => some description
)
)
This is my .ts file: import { Component } from '@angular/core'; import { NavController } from 'ionic-angular';
@Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage {
items:any[];
constructor(public navCtrl: NavController) {
}
this.items =
}
Please help me with this , I need to find a way to loop through this data and display it in the app. Thanks in advance !! Looking forward to some answers.