I'm looking to modify the following method to change the return type to a Promise or Observable:
basketItemNodes: TreeNode[] = [];
getBasketItems() {
this.basketService.getAllBasketItems()
.subscribe(
res => {
this.basketItemNodes = <TreeNode []> res;
},
err => {
console.log(err);
}
);
return this.basketItemNodes;
}
Any suggestions on how to achieve this?