How can I create a variable in a service that gets its data from a promise yet is shared between two components?

后端 未结 3 352
天涯浪人
天涯浪人 2021-01-15 19:41

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

3条回答
  •  遥遥无期
    2021-01-15 20:31

    @Krenom's answer was corrrect. with one import needing to be changed on my setup.

    I needed import { Observable, Observer } from 'rxjs/Rx';import { Observable, Observer } from 'rxjs/Rx';

提交回复
热议问题