Created
June 1, 2019 04:26
-
-
Save alvarocamillont/78a92ebabea640f32773f1fd3ee08c3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient } from '@angular/common/http'; | |
import { Component, OnInit } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { People, Planet } from '../model/api'; | |
@Component({ | |
selector: 'app-example-sync', | |
templateUrl: './example-sync.component.html', | |
styleUrls: ['./example-sync.component.css'] | |
}) | |
export class ExampleSyncComponent implements OnInit { | |
people$: Observable<People>; | |
planet$: Observable<Planet>; | |
constructor(private http: HttpClient) {} | |
ngOnInit() { | |
this.people$ = this.http.get<People>('https://swapi.co/api/people/3/'); | |
this.planet$ = this.http.get<Planet>('https://swapi.co/api/planets/5/'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment