40 lines
944 B
TypeScript
40 lines
944 B
TypeScript
import {Component} from "@angular/core";
|
|
import {User} from "../models/model-interfaces";
|
|
import {ActivatedRoute, Router} from "@angular/router";
|
|
import {UserService} from "../services/user-service/user.service";
|
|
import {Subscription} from "rxjs/Subscription";
|
|
|
|
|
|
@Component({
|
|
selector: 'army-member',
|
|
templateUrl: './army-member.component.html',
|
|
styleUrls: ['./army-member.component.css']
|
|
})
|
|
export class ArmyMemberComponent {
|
|
|
|
subscription: Subscription;
|
|
|
|
user: User = {};
|
|
|
|
constructor(private router: Router,
|
|
private route: ActivatedRoute,
|
|
private userService: UserService) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.subscription = this.route.params
|
|
.map(params => params['id'])
|
|
.filter(id => id != undefined)
|
|
.flatMap(id => this.userService.getUser(id))
|
|
.subscribe(user => {
|
|
this.user = user;
|
|
});
|
|
|
|
};
|
|
|
|
backToOverview() {
|
|
this.router.navigate(['cc-overview']);
|
|
}
|
|
|
|
}
|