Linked Questions
68 questions linked to/from What is the difference between BehaviorSubject and Observable?
1
vote
3
answers
9k
views
Subject vs BehaviorSubject in Angular [duplicate]
I am passing data between 2 independent components using shared service. When I used a subject in my shared service, I could not see the subscribed data in html of the subscribed component but could ...
0
votes
1
answer
323
views
Angular: Service Observable doesn't fire in component [duplicate]
my effects when erring, calls a method in service to display a dialogue. When dialogue completes, it puts result into an observable.
I have a component that is listening to that observable inside ...
280
votes
8
answers
169k
views
Subject vs BehaviorSubject vs ReplaySubject in Angular
I've been looking to understand those 3:
Subject
BehaviorSubject
ReplaySubject
I would like to use them and know when and why, what are the benefits of using them and although I've read the ...
78
votes
10
answers
213k
views
Angular cli generate a service and include the provider in one step
It is possible generate a service with angular cli and add it as a provider in the app.module.ts in a single step or using an special option in the ng g service command?
When a execute:
$ ng g ...
55
votes
9
answers
88k
views
Angular/RxJS 6: How to prevent duplicate HTTP requests?
Currently have a scenario where a method within a shared service is used by multiple components. This method makes an HTTP call to an endpoint that will always have the same response and returns an ...
57
votes
4
answers
173k
views
Typescript Angular - Observable: how to change its value?
Maybe I'm missing something. I can't find a simple tutorial for Observable and its syntax. I'm working with Angular, I need to call a function (defined in a component) from a service. I read this ...
23
votes
4
answers
43k
views
rxjs observable angular 2 on localstorage change
I am trying to create an observable that returns values when changes to a localStorage variable happens. My subscriber is not getting the new values upon changes to localStorage (or for that matter an ...
21
votes
5
answers
24k
views
Angular: cdkVirtualFor not rendering new items
I'm building a vertically scrolling calendar. I'm getting the initial days to load, but when new days are added to the list, they aren't being rendered.
<cdk-virtual-scroll-viewport
class="demo-...
12
votes
2
answers
29k
views
Observable from a string (Angular 2)
I am pretty new to Observables. How would I create Observable just from a simple string? Then subscribe to it and output it when it changes.
Does that make sense?
I don't have any luck with google ...
6
votes
3
answers
16k
views
Angular2 - Interaction between components using a service
I have two component A and B, where component A contains a button. I wish when user click on this button, fire a function on component B
<A></A>
<router-outlet></router-outlet>...
13
votes
1
answer
29k
views
RxJS: Correct way to manually emit an Observable
Working with RxJS in Angular 4.x, I'm seeing two very different patterns for generating Observables from streams of user initiated actions. One stream is the direct result of a user clicking an 'add ...
10
votes
2
answers
6k
views
BehaviorSubject firing twice
Im using BehaviourSubject from RxJS:
private rights = new BehaviorSubject<Array<string>>([]);
updateRights(rights: Array<string>) {
this.rights.next(rights);
}
getRights(): ...
3
votes
2
answers
9k
views
Angular 4 - rxjs BehaviorSubject usage in Service
My Service code looks like below -
DataService
@Injectable()
export class DataService {
...
private serviceRequestDtoSource = new BehaviorSubject<ServiceRequestDto>(null);
serviceRequestDto$ =...
6
votes
2
answers
8k
views
How to easily convert or assign an Observable to a Behavior Subject, so other component can share it
I am new to Observable style programming. I have a question: I want to share user info across the app between component - and I use BehaviorSubject to share this info. This is inspired by sharing ...
2
votes
2
answers
6k
views
How to use BehaviourSubject to get All Items and Single Item?
I am using the BehaviorSubject following the article here:
https://coryrylan.com/blog/angular-observable-data-services
In this article the author is using loadAll() to load all items and load() for ...