Skip to content

Instantly share code, notes, and snippets.

@peterbsmyth
Created May 9, 2017 21:50
Show Gist options
  • Save peterbsmyth/c449bd8bbdb5220fc9b8baebe971cd96 to your computer and use it in GitHub Desktop.
Save peterbsmyth/c449bd8bbdb5220fc9b8baebe971cd96 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { UserService } from './user.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
constructor(private userService: UserService) { }
ngOnInit() {
this.userService.getUsers().subscribe(
users => console.log('users', users),
error => console.error('error', error));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment