I have a service in an Angular 2 using TypeScript. I want to be able to share an array of values that I get from that service. when one component makes a change to the array
In your component
//set favorites getFavorites(): void{ this.favoriteService .getFavorites() .then(favorites => this.favoriteService.favorites = favorites); } // get favorite this.favorites = this.favoriteService.favorites;//access it from service