app.component.ts
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import "rxjs/add/operator/mergeMap";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html",
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
myItems: any[];
constructor(private httpClient: HttpClient) {
}
ngOnInit(): void {
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena")
.mergeMap((kums) => this.httpClient.get<any[]>(kums.repos_url))
.subscribe((results) => {
this.myItems = results;
});
}
}
<ActionBar title="Home" class="action-bar">
</ActionBar>
<ListView [items]="myItems">
<ng-template let-item="item">
<StackLayout>
<Label [text]='item.owner.login'></Label>
<Label [text]='item.name'></Label>
</StackLayout>
</ng-template>
</ListView>
import { Component, OnInit } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import "rxjs/add/operator/mergeMap";
@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html",
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
myItems: any[];
constructor(private httpClient: HttpClient) {
}
ngOnInit(): void {
this.httpClient
.get<any>("https://api.github.com/users/kumaran-dena")
.mergeMap((kums) => this.httpClient.get<any[]>(kums.repos_url))
.subscribe((results) => {
this.myItems = results;
});
}
}
app.component.html
<ActionBar title="Home" class="action-bar">
</ActionBar>
<ListView [items]="myItems">
<ng-template let-item="item">
<StackLayout>
<Label [text]='item.owner.login'></Label>
<Label [text]='item.name'></Label>
</StackLayout>
</ng-template>
</ListView>
Comments
Post a Comment