Questions tagged [subject-observer]

Use this tag for questions related to an Observer for a Subject. Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.

119 questions
0
votes
0 answers

Angular: proper way to get results after filter changed

In my simple app I have FilterComponent, ListComponent and one service (I call it GithubService). I need that search word typed in FilterComponent address via http to github and return results to ListComponent. export class GithubService { …
Lapenkov Vladimir
  • 3,066
  • 5
  • 26
  • 37
0
votes
1 answer

Can't resolve all parameters for Component: (?)

I've got an Error message, as the title says. I searched for a solution here but unfortunately @Injectable() is not working, since I'm working with interfaces , and I also tried @Input(). What I'm trying to do here is an Observer pattern, to get…
Roadman1991
  • 169
  • 3
  • 16
0
votes
0 answers

How to write Jasmine test for subject observable method?

I'm trying to write a test for the following method call in the ngOnInit method of my component: person: Person; ngOnInit(){ this.service.person.asObservable().subscribe(data => { this.methodCall(data); } } Here is my service: person = new…
user1324418
  • 267
  • 1
  • 6
  • 14
0
votes
1 answer

How to create a Map to store Subject/BehaviorSubject of different data types

In Typescript, how to create a Map to store Subject/BehaviorSubject of different data types In one of my services classes, I want to have a Map to store Subject of different data types. (The key of the map is number). How do I declare the Map?…
dGayand
  • 599
  • 1
  • 7
  • 15
0
votes
2 answers

Angular 2+: Searching in json data when search is a shared component

the app.component has json data displayed in the view using *ngfor. User can perform search as he/she types in the search box (basically on keyup event). For future ease, I have made this search.component as a shared component. I have written a code…
Pranjal Successena
  • 907
  • 1
  • 11
  • 24
0
votes
3 answers

Angular 6 subscription invoke multiple times

I just working on a new Angular 6 WebApp which the whole communication between the components is based on Subjects and Subscriptions. The whole subscription is implemented in the dashboard component (level 1 under the root). On the Dashboard, the…
0
votes
2 answers

RxJS Subject of Subjects

I'm trying to create a subject of a list of downloading assets that sends actions for each asset, using a Subject of Subjects if that's possible? export function onDownloadGuide(action$,store){ return action$.ofType(DOWNLOAD_GUIDE) …
beek
  • 3,522
  • 8
  • 33
  • 86
0
votes
1 answer

Incorrect value in observable subscribe function

I have written a custom event bus using BehaviorSubject. It simply executes the subscription passed by a subscriber when a publisher publishes an event. The event bus logic seems to work correctly, but my local variables are not updating correct…
0
votes
1 answer

Proxy an Observable and connect it in callback

I'm trying to return an Observable that is created asynchronously in a callback: const mkAsync = (observer, delay) => setTimeout(() => Observable.of('some result').subscribe(observer), delay) const create = arg => { const ret = new Subject() …
André Rüdiger
  • 91
  • 1
  • 11
0
votes
1 answer

Making Subscribe to wait in Angular 4 for Subject

I have a text field in my HTML which calls back-end service in real time based on text entered. If a user enters something like 'abc', my service returns an object array which has this 'abc' name. I am using Observable and Subject for this and I am…
0
votes
1 answer

Is parent to parent communication is possible in angular 5 using Subject or Behaviour Subject

Is parent to parent communication is possible in angular 5 using Subject or Behaviour Subject. For example: ListComponent and DetailComponent. Both are different component and views. When i clicked save data of a form in ListComponent, it should…
RK6
  • 424
  • 1
  • 5
  • 23
0
votes
2 answers

Subscription to Subject in a pipe doesn't work; Angular4

im struggling with subscribing to select dropdown change in Angular 4. The change of my searchType variable is only visible after calling a test() function through click event but ofc I need Angular to subscribe to changes instantly. Sidenote: I'm…
0
votes
1 answer

Angular subject not updating form

I've been following a course on LinkedIn Learning but clicking on a list and having the values populate a form are not working for me. I'm new to Angular (and development) so apologies if this is silly, or I don't describe it correctly. I have 2…
leadfollowmove
  • 69
  • 2
  • 12
0
votes
1 answer

RxJs Subscription does not get fired in the root angular module

I have a component that listens to http calls for displaying loaders. I have spinner component and a spinner service having a spinnerEvent$ Angular4 Event Emitter. Here is my component constructor. constructor( private spinnerService:…
Abhishek Pandey
  • 300
  • 1
  • 13
0
votes
1 answer

What is the elegant way of processing a list of asynchronous events and continuing once they are all complete?

I am building an Angular app. In the constructor of my component, I am initiating a request for several elements from the server, which naturally occur asynchronously. Those requests are returned to me as rxjs/Behavior objects, to which I am…
John Arrowwood
  • 2,370
  • 2
  • 21
  • 32