import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { ApiProvider } from './../../providers/api/api';
import { User } from './../../app/users/user';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  users: User[];

  constructor(public navCtrl: NavController, public apiProvider: ApiProvider) {
  }

  ngOnInit() {
    this.loadUsers();
  }

  loadUsers() {
    this.apiProvider.getUsers().subscribe(
      data => this.users = data["_embedded"]["users"],
      err => {
          console.log(err);
      });
  }
}
