I'm new to Angular and TypeScript so appologies if this is a stupid question. I'm trying to save the value of a returned object to a nested property in an object of type any. However, its not allowing me so could anyone enlighten me on my error.
sharedData:any;
constructor(private menuService: MenuService) { }
addToBasket(item:any): void {
this.sharedData.basketList.push(item);
}
ngOnInit() {
this.sharedData.menu = this.menuService.getMenu();
}
It works fine when I have it as this.menu = this.menuService.getMenu();