I have following code
export class AppComponent implements OnInit {
public guests: any[] = [];
constructor(private apiService: ApiService) {
}
ngOnInit(): void {
this.apiService.getAllGuestsQuery().find({
success(results) {
for (let i = 0; i < results.length; i++) {
const object = results[i];
console.log(object.get('companyName'));
}
},
error(error) {
console.log("Error: " + error.code + " " + error.message);
}
});
}
}
The getAllGuestsQuery returns a Parse.Query object. I would like to store the result in my guests array. E.g. do something like this.quests = results
But I cannot access this.guests class variable inside the success method.
How can I do that?