Skip to content

Instantly share code, notes, and snippets.

@evertonrobertoauler
Last active October 10, 2017 12:35
Show Gist options
  • Save evertonrobertoauler/851d79c1e006ca4311948f031a4c8985 to your computer and use it in GitHub Desktop.
Save evertonrobertoauler/851d79c1e006ca4311948f031a4c8985 to your computer and use it in GitHub Desktop.
universal-demo-v5/src/app/app.component.ts 2
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'app';
dogs: any;
constructor(
private http: HttpClient
) { }
ngOnInit() {
this.http
.get('https://dog.ceo/api/breeds/list/all')
.subscribe(data => {
console.log(data);
this.dogs = data;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment