I should have had

this.historyComponent.historyTimespanChanged$
    .subscribe




On Saturday, October 7, 2017 at 2:52:26 PM UTC-7, Reza Razavipour wrote:
>
> One of my angular component needs to allow subscriptions to a number that 
> it holds. I am trying to turn this number into an observable so others can 
> subscribe to it.
>
> my publisher looks like
>
>     private countChanged = new BehaviorSubject<any>(null);
>     public historyTimespanChanged$ = this.countChanged.asObservable();
>
>     private publish() {
>         this.countChanged.next(this.count);
>     }
>
>     expandTimeSpan() {
>         this.count ++;
>         this.publish();
>     }
>
>     reset() {
>         this.count = 0;
>         this.publish();
>     }
>
>     getHistoricalCount() {
>         return Observable.of(this.count);
>     }
>
> my observer looks like
>
>             this.historyComponent.getHistoricalCount()
>             .subscribe(count => {
>                 if (count !== 0 ) {
>                     console.log('new history timespan expanded: ', count);
>                     this.historyCount = count;
>                     this.retrieveHistoricalData();
>                 }
>             });
>
> but the subscriber never gets called.
> Can anyone see what I am doing wrong?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to