rxjs

RxJS All Individual Observables completed

杀马特。学长 韩版系。学妹 提交于 2021-01-29 08:02:09
问题 I have an array of unique ID's and want to perform a bulk action (HTTP patch, delete etc) on them. That needs to be done individually and I need to display individual results. As the requests are individual and it's responses should not affect each other. Results are displayed as they are received. Every call is a separate Observable and what I'm looking for is a way to know when all Observables have completed . The onCompleted method works only when there are no errors. The goal is to

how to display @feathersjs-client results in Angular

假装没事ソ 提交于 2021-01-29 07:40:28
问题 In process to integrate feathersjs-client into an angular frontend using feathers-chat-angular code as a guide. Backend up and running: MongoDB, Mongoose, express/feathers server. Was able to retrieve data from the frontend, got stuck displaying the response data. Feathers-reactive currently not used. Warning beginner@work ... Was looking into Observables but always ran into: ERROR: Uncaught (in promise): TypeError: this.dataService.issues$(...).pipe... is not a function. Played around with

How to wait for subscribe to finish Angular 5?

点点圈 提交于 2021-01-29 07:30:41
问题 I am working on an Angular 5 app. I get an error because I have a function that executes before another function is done, hence getting a null variable. I have tried to use .map and .subscribe with Observable, but didn't succeed. Here is the code: loadData is called from my app.component class : ngOnInit() { this.dataService.loadData(sessionStorage.getItem(...); } While that function executes, another function from data.component class (dataService.getData) is called on initialization:

Angular app - User login, logout and session reload with Observables

给你一囗甜甜゛ 提交于 2021-01-29 07:10:58
问题 This is a followup question for another question I had posted, which remains half-solved: RxJS shareReplay() does not emit updated value I am creating an Angular app and I'm trying to use Observables extensively. The problem is with creating a UserService class which has an observable user$ which can be piped to throughout the application to get the currently logged in user. The currently accepted answer (by @DeborahK - she had been very patient with me) is a great solution, but has a bug - A

How to create new element and render data each time the data is fetched in react

╄→гoц情女王★ 提交于 2021-01-29 06:40:50
问题 I am new to react and I need to render and list data fetched from firebase to the html I tried doing this, const Music = ({ match }) => { const [title, setTitle] = useState(null) const [user, setUser] = useState(null) const [pfp, setPfp] = useState(null) const { params: { uID } } = match; useEffect(()=>{ firebase.database().ref("users/"+uID+"/public/songs/").on("value", (snapshot)=>{ var musics = snapshot.val() Object.values(musics).forEach((value)=>{ //I need to render this title each and

Rxjs-Javascript: How to catch the event of crossing the finish line by a running sprite

回眸只為那壹抹淺笑 提交于 2021-01-29 05:56:59
问题 below is the code of a game: a sprite moving along a straight line by pressing on the left and right keys of the keyboard from position (0,200) to (300,200) I need an observable that catches the event of crossing the finish line by the sprite in position x=300 and y = 200. Thank you so much. This is my code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title>TP RXJS</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.5.5/rxjs.umd.js"> </script> <style> #screen{

How to return an observable from service in angular after chaining pipe operations

▼魔方 西西 提交于 2021-01-29 05:55:50
问题 I'm trying to chain / pipe operations and return an Observable from a Service in angular which uses angular fire. With promises I have this working Service saveDiploma(diploma: { title: any; description: any; picture: any }) { return new Observable(observer => { const id = this.db.createId(); this.storage.ref(`diplomas/${id}/original.jpg`) .putString(diploma.picture, 'data_url') .then(task => { task.ref.getDownloadURL() .then(url => { const saved = { title: diploma.title, description: diploma

Adding service dependent logic to NGRX actions in an Angular application

瘦欲@ 提交于 2021-01-29 04:46:09
问题 I have an actions file like this: export enum ActionTypes { FailureAction = 'Failure action', } export class FailureAction implements Action { readonly type = ActionTypes.FailureAction; constructor(public payload: any) { } } export type ActionTypes = FailureAction; I want to add some logic in the FailureAction class so that whenever this action gets called, we call a service that decides how to show an error (the only parameter is a code). I created a class that has the code parameter in the

Angular 7 CI rxjs/Operators cannot find module

ⅰ亾dé卋堺 提交于 2021-01-28 23:40:55
问题 I have tried setting up CI for my angular project using Circle CI following this configuration: https://angular.io/guide/testing#configure-project-for-circle-ci However, when ng test runs I get the following error: ERROR in src/app/account/login-form/login-form.component.ts(4,26): error TS2307: Cannot find module 'rxjs/Operators'. Locally, if I delete node_modules/ and run npm install followed by npm test I don't have any issue with rxjs. My package.json : "dependencies": { "@angular

Angular 7 CI rxjs/Operators cannot find module

喜你入骨 提交于 2021-01-28 22:45:59
问题 I have tried setting up CI for my angular project using Circle CI following this configuration: https://angular.io/guide/testing#configure-project-for-circle-ci However, when ng test runs I get the following error: ERROR in src/app/account/login-form/login-form.component.ts(4,26): error TS2307: Cannot find module 'rxjs/Operators'. Locally, if I delete node_modules/ and run npm install followed by npm test I don't have any issue with rxjs. My package.json : "dependencies": { "@angular