Questions tagged promise

Explore the latest questions and answers asked by our top developers.

use promise in array items inside a Map object

I need to iterate over a Map object – to make it realistic – lets say it is a collection of Polygons (Polygons is represented by a collection of coordinates – lat and long). Every item in the Map has a collection of items (coordinates). With every item (coordinate) in the Map (polygon), I need […]

By Guy E
Categorized as angular, asynchronous, promise, rxjs, typescript Tagged , , , ,

How to Promise data from Subject?

This code only Promises the Subject itself, not the data: getOption() { return this.subject; } getData() { this.getOpt().then(data => this.subject = data); } getOpt(): Promise<Subject<any>> { return this.globalFooService.getObservable().toPromise(); } I tried implementing pipe, tap and first but dunno what to import from rxjs for them. Also am trying to avoid subscribe because of previous question. […]

By ForgiveMyParlance
Categorized as angular, asynchronous, promise, rxjs, subject Tagged , , , ,

JS forEach – process images files in the order they are loaded not random

I want to upload multiple images (different sizes), compress each image and add it to a PDF file in the order they are uploaded. When all the uploaded images are processed I want to save the PDF file In the attached image the FileList is in the correct order but when I try to process […]

getting "error properties: Object({ rejection: TypeError: Cannot set properties of null (setting ‘value’), promise: [object Promise] " in karma jasmin

what does this error mean in karma jasmine testing ? this error is showing for login page validation and while testing athentication which is working fine in app, however giving error in testing Error: Uncaught (in promise): TypeError: Cannot set properties of null (setting ‘value’) TypeError: Cannot set properties of null (setting ‘value’) error properties: […]

How can I get some data before the response of an API?

First, I have 2 APIs, the first one store one employee into a database but if we have too much data to store my second api call have to be launch every 1000ms to get the current data ID so that I can create progress bar after that… Here is my API call on click […]

Type ‘Promise<Hotel[]>’ is missing the following properties from type ‘Hotel[]’: length, pop, push, concat, and 26 more

Related to this question. I decided to rewrite my code with Promises, but how would I Promise an Array of interfaces without requiring all of the Array properties? import { Component, OnInit } from ‘@angular/core’; import PouchDB from ‘node_modules/pouchdb’; interface Hotel { name: string; } @Component({ selector: ‘app-tab1’, templateUrl: ‘’, styleUrls: [‘’] }) export class […]

How to avoid to return an observable inside a promise

I’m using AngularFire to manage user inside my app. I’m still learning about observables and rxjs. I’m trying to call signInWithEmailAndPassword method – which return a promise – and to retrieve a doc from a collection. In my service I get the document using this method: getDbUser(uid): Observable<User> { return this.angularFirestore.collection<User>(USERS).doc(uid).valueChanges() } and I login […]

Angular – How to properly use Promise instead of setTimeOut

I am trying call call 2 functions one after another, if I use setTimeOut, it is working as expected. But I am trying to change the code to use the Promises. Below are parts of my code public getCustomFieldsData() { return new Promise<void>((resolve, reject) => { this.originalData = []; this.customFieldsService.getCustomFields(this.columnList, this.pageNumber, this.pageSize, null).subscribe(res => { […]

By vamsi
Categorized as angular, promise Tagged ,

Angular problem material mat-tabs does not show scroll arrows

I am loading some mat-tabs dynamically via a promise, but the mat-tab does not show the arrows to move when necessary. enter image description here but when clicking on a tap if they already show correctly enter image description here My code looks like this import { CsmEmployerEntity } from ‘@addons/casemanager/main/graphql/interfaces/generalcase.interfaces’; import { ChangeDetectionStrategy, ChangeDetectorRef, […]

this.http.get return not found just on app module

On Angular 11, I am calling an endpoint in my service getServerTime() { return this.http.get(environment.api.serverTime); } injecting above service into app.component this.serviceA.getServerTime().subscribe((serverTime: any) => { this.offset = new Date().getTime() – serverTime; }); thorws } ​ message: " Http failure response for https://url/ntp: 500 undefined however if i put all the code in a component that […]

1 2 3 27

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us