app.component.ts
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from 'rxjs/Rx';
import "rxjs/add/observable/forkJoin";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html",
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor(private httpClient: HttpClient) {
}
ngOnInit(): void {
Observable.forkJoin([
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena"),
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena/followers"),
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena/subscriptions")
]).subscribe((response) => {
console.log("<<<<<<<<<<<<<<<<<<<<<<<<< first value>>>>>>>>>>>" + JSON.stringify(response[0]));
console.log("<<<<<<<<<<<<<<<<<<<<<<<<< second value>>>>>>>>>>>" + JSON.stringify(response[1]));
console.log("<<<<<<<<<<<<<<<<<<<<<<<<< third value>>>>>>>>>>>" + JSON.stringify(response[2]));
});
}
}
<ActionBar title="Home" class="action-bar">
</ActionBar>
<ScrollView class="page">
<StackLayout class="home-panel">
<Label textWrap="true" text="Play with forkJoin!" class="h2 description-label"></Label>
</StackLayout>
</ScrollView>
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable } from 'rxjs/Rx';
import "rxjs/add/observable/forkJoin";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html",
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor(private httpClient: HttpClient) {
}
ngOnInit(): void {
Observable.forkJoin([
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena"),
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena/followers"),
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena/subscriptions")
]).subscribe((response) => {
console.log("<<<<<<<<<<<<<<<<<<<<<<<<< first value>>>>>>>>>>>" + JSON.stringify(response[0]));
console.log("<<<<<<<<<<<<<<<<<<<<<<<<< second value>>>>>>>>>>>" + JSON.stringify(response[1]));
console.log("<<<<<<<<<<<<<<<<<<<<<<<<< third value>>>>>>>>>>>" + JSON.stringify(response[2]));
});
}
}
app.component.html
<ActionBar title="Home" class="action-bar">
</ActionBar>
<ScrollView class="page">
<StackLayout class="home-panel">
<Label textWrap="true" text="Play with forkJoin!" class="h2 description-label"></Label>
</StackLayout>
</ScrollView>
Comments
Post a Comment