Angular 2 HTTP Progress bar

Currently (from v. 4.3.0, when using new HttpClient from @ngular/common/http) Angular provides listening to progress out of the box. You just need to create HTTPRequest object as below: import { HttpRequest } from ‘@angular/common/http’; … const req = new HttpRequest(‘POST’, ‘/upload/file’, file, { reportProgress: true, }); And when you subscribe to to request you will … Read more

How to use angular 2 service with Ionic 2?

There is no use of Bootstrap() in Ionic2, only use of @App to declare your app. You still need to declare your service in your @Page component. Create your service import {Injectable} from “angular2/core”; import {Http} from “angular2/http”; @Injectable() export class DataService { constructor(http: Http) { this.http = http; this.data = null; } retrieveData() { … Read more

Adb install failure: INSTALL_CANCELED_BY_USER

The same trouble with same device has been here. So, it’s Xiaomi trouble, and here is a solution for this problem: Go to the “Security” application and tap “Options” at top right corner Scroll down to “Feature Settings” group, and look for “Permissions” At there switch off “Install via USB” option, which manages installation of … Read more

Merging http observables using forkjoin

Try to use combineLatest instead of forkJoin : With combineLatest : const combined = Observable.combineLatest( this.http.get(‘https://testdb1.firebaseio.com/.json’).map((res: Response) => res.json()), this.http.get(‘https://testdb2.firebaseio.com/.json’).map((res: Response) => res.json()) ) combined.subscribe(latestValues => { const [ data_changes , data_all ] = latestValues; console.log( “data_changes” , data_changes); console.log( “data_all” , data_all); }); You can also handle it by forkJoin , but forkJoin will … Read more