I'm a bit confused about angular Http Get observable. I want to assign the results of my observable to my class variable. If I log inside the subscribe, it prints the class variable OK. If I log outside of the subscribe, it shows an empty array. How do I assign to my class variable?
classes = [];
constructor(private navController:NavController, private httpService: HttpService) {
this.httpService.getCalendarConfig()
.subscribe((data) => {
this.classes = data;
console.log("inside" + this.classes);
});
console.log("outside" + this.classes);