|
@@ -1,4 +1,6 @@
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
+import {UserService} from "../../../dtcservice/user.service"
|
|
|
+import {User} from "../../../dtcservice/user"
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-user-list',
|
|
@@ -7,9 +9,16 @@ import { Component, OnInit } from '@angular/core';
|
|
|
})
|
|
|
export class UserListComponent implements OnInit {
|
|
|
|
|
|
- constructor() { }
|
|
|
+ constructor(private userService:UserService) { }
|
|
|
+ users:User[]
|
|
|
+
|
|
|
+ getUsers():void{
|
|
|
+ this.userService.getUsers()
|
|
|
+ .subscribe(users => this.users = users);
|
|
|
+ }
|
|
|
|
|
|
ngOnInit() {
|
|
|
+ this.getUsers()
|
|
|
}
|
|
|
|
|
|
}
|