observable

rxJS observable not reaching subscribe

谁说我不能喝 提交于 2019-12-20 05:02:52
问题 I'm with Angular 2 and RxJS and I'm having a hard time setting up a simple observables system. As far as I understand, operator do is used for side effects, and you place the code to deal with the results returned by the observable in the susbcribe() function. So my Component ask the Service to initialize the system. The Service makes 2 http calls to the server and combines them both in a single stream for the component to subscribe and make sure everything is ready. One of the 2 http calls

rxJS observable not reaching subscribe

这一生的挚爱 提交于 2019-12-20 05:01:22
问题 I'm with Angular 2 and RxJS and I'm having a hard time setting up a simple observables system. As far as I understand, operator do is used for side effects, and you place the code to deal with the results returned by the observable in the susbcribe() function. So my Component ask the Service to initialize the system. The Service makes 2 http calls to the server and combines them both in a single stream for the component to subscribe and make sure everything is ready. One of the 2 http calls

Update several component properties with a single http call using observables

試著忘記壹切 提交于 2019-12-20 04:27:11
问题 Previous post related : Angular2 : Reduce number of Http calls The context is still the same : I'm trying to setup a "dico" component, that need an ID and a Language in input, and should give me some translated Text from my database. dico.component.ts : @Component({ selector: 'dico', template: `{{text}}` // => The text I'm trying to update }) class Dico implements AfterViewInit { // Définition des paramètres et du texte en sortie @Input() private dicoID: string; @Input() private dicoLang:

get new ticket then retry first request

自闭症网瘾萝莉.ら 提交于 2019-12-20 04:07:11
问题 Update: I extend Http class, when I deleteDocument() I want handle error then getTicket() then retry ma request deleteDocument() with new this.TICKET : @Injectable() export class HttpService extends Http { public SERVER_URL: string = 'http://10.0.0.183:8080/alfresco/s/' public TICKET: string = '' constructor(backend: ConnectionBackend, defaultOptions: RequestOptions) { super(backend, defaultOptions); } post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response> { return

Exception: ObjectUnsubscribedError when working with Observables with RxJS and Angular2

那年仲夏 提交于 2019-12-20 02:07:14
问题 I am still trying to teach myself Angular2 (and I really need to find some better resources) but I have a question. I have moved my data calls to a service and I am using Reactive Subject & BehaviorSubject after instruction from a friend. My calls works, I have a mock REST service from a real back end that gives me a data object (that is an oject of mock user data), my response matches a type I have defined however in my top level app (called App.ts) I have to wait for the response. Now this

Iterate through an array of objects Angular 2

泄露秘密 提交于 2019-12-19 19:52:21
问题 I have an array of objects received in service file from a json file. When I subscribe it in the component and try to iterate through it, I am getting the following error: EXCEPTION: Error in app/dashboard/features/fleet/fleetControlPanel/fleetControlPanelTemplate.html:38:14BrowserDomAdapter.logError @ browser_adapter.ts:78BrowserDomAdapter.logGroup @ browser_adapter.ts:89ExceptionHandler.call @ exception_handler.ts:53(anonymous function) @ application_ref.ts:304schedulerFn @ async.ts

Filtering a Touch.FrameReported IObservable using arbitrary boolean condition that changes over time

给你一囗甜甜゛ 提交于 2019-12-19 10:53:32
问题 I've been playing around with the Reactive Extensions (RX) in Windows Phone 7 and am very close to a working solution but got caught up on one small detail. I am trying to process the raw touch events using Touch.FrameReported and Observable.FromEvent (a bit of an educational quest to learn the Touch API and RX better), but I only want to process the events under certain conditions. For example I may want to filter the subscription to the touch down and touch up events only when a specific

Filtering a Touch.FrameReported IObservable using arbitrary boolean condition that changes over time

本秂侑毒 提交于 2019-12-19 10:53:10
问题 I've been playing around with the Reactive Extensions (RX) in Windows Phone 7 and am very close to a working solution but got caught up on one small detail. I am trying to process the raw touch events using Touch.FrameReported and Observable.FromEvent (a bit of an educational quest to learn the Touch API and RX better), but I only want to process the events under certain conditions. For example I may want to filter the subscription to the touch down and touch up events only when a specific

Converting Angular2 Http response to ConnectableObservable

半城伤御伤魂 提交于 2019-12-19 10:25:43
问题 I must admit that I am doing my first steps with Angular2, and I am running into an issue here, which I have some problems understanding. I am using angular2@2.0.0-beta.0, which has a dependency on rxjs@5.0.0-beta.0. My intention is to make an HTTP request (to a REST service) and allow the response to be sent to multiple subscribers of the returned observable. If I understand the documentation correctly, I can use the publish() function to convert the Observable returned by e.g. the http.post

What does subscribe do, and how it is related to Observable?

青春壹個敷衍的年華 提交于 2019-12-19 05:01:23
问题 I'm new to Angular and the tutorial I followed has the term " Observable ". The tutor explained it, but I didn't completely understand. What is an Observable , and why do we always have to call observable.subscribe() ? What does subscribe() actually do? 回答1: What is an Observable ? An Observable can be seen as a data source. That data might exist (or not) and might change over time (or not). An Observable emits data, until it has nothing to emit anymore and then completes (there are some