observable

AngularFire storage task observable never completes

烂漫一生 提交于 2019-12-24 07:26:52
问题 I am uploading a camera gallery image to firebase successfully, however I am unable to getDownloadURL() as the AngularFire storage task observable never completes. I have consulted the documentation following the 'Monitoring upload percentage' - Example Usage here Please can you kindly advise what I am doing wrong or recommend an alternative approach. Thanks. async onCamera(){ try{ const options: CameraOptions = { quality: 100, targetHeight:500, targetWidth:500, allowEdit: true,

Angular 2 Display value from Observable

瘦欲@ 提交于 2019-12-24 07:15:51
问题 Hi I want display my value from response http but I don't know what is the problem. http : getAllApiContext(){ const options = this.getOptions("..."); return this.http .get("jenkins/job/api_initialization/api/json", options) .map((data: any) => { return data.json().property[0].parameterDefinitions[1].choices; }) } She return array. My component.ts context: Observable<Array<any>>; ngOnInit() { this.jenkinsJob.getAllApiContext().subscribe(data => { this.context = data; }); }; My component.html

retryWhen with backoff

拟墨画扇 提交于 2019-12-24 06:44:49
问题 Trying to retry (with backoff logic) when error on http.get return this.http.get(this.urlToBackend) .map((res: Response) => res.json()) .retryWhen(errors => errors .zip(Observable.range(3, 15), (_, i) => i) .flatMap(i => { if (i >= 15) { throw errors; } let t = (Math.pow(2, i)) * 1000; return Observable.timer(t); })) .catch((error: any) => this.handleError(error, false, 0, this.urlToBackend)); Keep getting this error: TypeError: this.http.get(...).map(...).retryWhen is not a function at

Knockout observable change not detected if value changed externally

梦想的初衷 提交于 2019-12-24 01:43:30
问题 I have a list of text boxes bound to the ko.observableArray . I have to make sure that text box values can't be blank, and I do it with jQuery by setting the value to 0 if it's blank on blur() The problem is that the value change done with jQuery is not registered by knockout. How do I observe the value change in my model? See my simplified fiddle to get the point across - http://jsfiddle.net/k45gd/1/ HTML <input type="number" data-bind="value: age" /> <span data-bind="text: age"></span>

How to pass variable parameters to Observer?

↘锁芯ラ 提交于 2019-12-24 00:48:48
问题 I have two Observers that are merged with a flatMap. The first observer returns a value that is used when the second is called. Observable<Integer> mergedObservers = firstAPI.getFirstInfo(userLat, userLong) .flatMap(resultFirstObservable -> { try { return secondApi.getSecondInfo(resultFirstObservable.body().string(), "3") .onErrorResumeNext(e -> { e.printStackTrace(); return secondApi.getSecondInfo("defaultValue", "3"); }); } catch (IOException e) { e.printStackTrace(); secondApi

Angular 2 recursive http.gets of unknown depth

与世无争的帅哥 提交于 2019-12-24 00:29:47
问题 I've been using a pattern like the below to chain together http.gets in Angular2 to retrieve information from a hierarchical structure, two layers deep, of folders (all pseudotypescript): myObservable = this.myService.getSubFolders(topFolderUrl) .switchMap(subFolders=> this.myService.getInfoFromSubFolders(subFolders)) .map(subFolders=> => { ...do stuff with subFolders... return subFolders; } ); Where myService looks something like this: getSubFolders(topFolderUrl): Observable<Folder[]> {

Angular 2 Observable.forkJoin this._subscribe is not a function in [null]

て烟熏妆下的殇ゞ 提交于 2019-12-23 23:15:15
问题 I have this Angular2 Component, where I try to make two HTTP parallel requests to with PersonServie (that works fine). But the Observable.forkJoin method throws this error: EXCEPTION: TypeError: this._subscribe is not a function in [null] Evaluating getIdentificationTypes() and getPerson() function, each return an Observable object. What am I missing? import { Component, OnInit } from 'angular2/core'; import { Router, RouteParams } from 'angular2/router'; import {ROUTER_DIRECTIVES, ROUTER

Angular 2 Observable.forkJoin this._subscribe is not a function in [null]

谁说我不能喝 提交于 2019-12-23 22:35:20
问题 I have this Angular2 Component, where I try to make two HTTP parallel requests to with PersonServie (that works fine). But the Observable.forkJoin method throws this error: EXCEPTION: TypeError: this._subscribe is not a function in [null] Evaluating getIdentificationTypes() and getPerson() function, each return an Observable object. What am I missing? import { Component, OnInit } from 'angular2/core'; import { Router, RouteParams } from 'angular2/router'; import {ROUTER_DIRECTIVES, ROUTER

Preventing a Pyramid of Doom using rxjs .subscribe with Angular - flattening the number of .subscribes

China☆狼群 提交于 2019-12-23 22:30:18
问题 I'm currently looking into RxJS's .merge however I'll also ask the question here as I find explanations here at times to be brilliant. Okay, I have a form that depending on user input opens a modal window, I subscribe to the modal close event and pass back some data that I will use after I call / subscribe to a service method to retrieve some data, then when this has happened I do the same again and call / subscribe another service method to update some date then when this has finished I run

iOS RxSwift how to prevent sequence from being disposed on (throw error)?

我的未来我决定 提交于 2019-12-23 21:17:33
问题 I have a sequence made up of multiple operators. There are total of 7 places where errors can be generated during this sequence processing. I'm running into an issue where the sequence does not behave as I expected and I'm looking for an elegant solution around the problem: let inputRelay = PublishRelay<Int>() let outputRelay = PublishRelay<Result<Int>>() inputRelay .map{ /*may throw multiple errors*/} .flatmap{ /*may throw error*/ } .map{} .filter{} .map{ _ -> Result<Int> in ...} .catchError