I\'ve been learning TypeScript with Angular. And currently I stuck as this moment. Previously I used subscribed method and everything works flawlessly, but not I decided to
Given that your rest service or provider returns a Restaurant in this format (i've always used classes not interfaces, sorry i can't provide any help with this distinction, so in my example Restaurant is a class).
export class Restaurant {
_id: string;
name: string;
description:
string; email:
{
address: string;
confirmation_code: string;
confirmed: boolean;
};
auth: {
password: string;
};
branches: Branch[];
menus: Menu[];
images: File[];
cuisines: Cuisine[];
blocked: boolean;
created: Date;
business_hours: object;
}
You should be able to have angular serialise the response for you as an example:
getRestaurant(): Observable {
return this.http.get(environment.api + "/restaurant");
}
That is given you also have a also imported the other types Branch, Menu, File, Cuisine into the typescript file containing the restaurant. for example branch would look like
export class Branch {
// branches properties
}