Linked Questions

354 votes
23 answers
119k views

By using Http, we call a method that does a network call and returns an http observable: getCustomer() { return this.http.get('/someUrl').map(res => res.json()); } If we take this observable ...
Angular University's user avatar
0 votes
1 answer
4k views

I am building a simple web application which uses one endpoint ( let's say www.domain.com/card/cardname ) which returns an object as such: { name: 'john', type: 'male', text: 'funny guy' } I ...
George Katsanos's user avatar
43 votes
2 answers
35k views

I have two Angular2 components which need to share data via a service: @Injectable() export class SearchService { private searchResultSource = new Subject<string>() searchResult$ = this....
kdu's user avatar
  • 1,259
4 votes
3 answers
8k views

Using Angular 2, I receive JSON data from a service. Something like this: { "customerName": "foo", "customerAddress": "123 Somewhere", "products": [ { "...
ebakunin's user avatar
  • 3,821
5 votes
3 answers
6k views

I've found a number of approaches to cache reactive observables and, more specifically, the results of http requests. However, I am not fully satisfied with the proposed solutions because of the ...
Ultimacho's user avatar
  • 113
3 votes
2 answers
5k views

I have a Navigation bar in Angular 2. It works like below. <nav class="navbar navbar-toggleable-md navbar-light bg-faded"> <button class="navbar-toggler navbar-toggler-right" type="button"...
Angela P's user avatar
  • 2,029
4 votes
2 answers
2k views

I have two components using the same service. On FirstComponent, I get some data from a service: getLiveData() { Observable.interval(1000) .mergeMap(() => this.service.getData()) ....
brians69's user avatar
  • 485
1 vote
2 answers
2k views

Starting from THIS awesome response, I want to use many DataService instances inside another global service (SystemService) that store and serve many "cacheable" datas. I have imported the DataService ...
Massimo Magliani's user avatar
2 votes
1 answer
1k views

Even though it seems like a common situation I haven't found a decent solution of how do I share a data from the parent to children routes. Routes: { path: ':id', component: DetailComponent, ...
Zabavsky's user avatar
  • 13.7k
0 votes
2 answers
1k views

I just started playing with angular 2 and i've ran into a small problem, that i ve searched for in various forms and also angulars documentation. I've managed to make a service that makes a call and ...
Obretin Alexandru's user avatar
1 vote
1 answer
479 views

I need to cache server response in my service. I checked this question caching results with angular2 http service, here I have found 2 ways of doing that 1) Observable.share() - but as it said in the ...
Victor Bredihin's user avatar
1 vote
1 answer
879 views

The potential 'duplicate' questions do not answer my question - I potentially think my use of Observables is different than the examples and as I point out, I attempted using share() unsuccessfully. ...
George Katsanos's user avatar
2 votes
0 answers
718 views

Setup: I have a LoggedInGuard (injected with AuthService). In AuthService's constructor I've subscribed to http.get to set this.loggedIn = true based on the response from server. Question: When user ...
Anand Rockzz's user avatar
  • 6,728
0 votes
1 answer
415 views

(In an Angular 2 app): If the data is already in memory, just return it, otherwise do a HTTP GET. It sounds like it should be simple. Is there any easier way than the following? [LOGIC] If the data ...
John Pankowicz's user avatar
3 votes
2 answers
93 views

I got one controller CounterpartyCtrl that is used by two views. The first view contains a selector which requires all the records from collection. So I fetch all the objects and put them into $scope....
Billy Logan's user avatar
  • 2,518