subscribe observable (as subject)
i have following example code which returns id+1 of it’s elements: EntitiesService: public create(model: Model): Observable<number> { var subject = new Subject<number>(); this.GetAll().subscribe(result => { if (result.find(x => x.name == model.name)) { return; } model.id = result[result.length – 1].id + 1; EntitiesService.mock.push(model); subject.next(model.id); }) return subject.asObservable(); } and i would like to subscribe it to… Read More subscribe observable (as subject)