38 lines
952 B
TypeScript
38 lines
952 B
TypeScript
import {Component} from "@angular/core";
|
|
import {Army} from "../models/model-interfaces";
|
|
import {ArmyService} from "../services/army-service/army.service";
|
|
import {ActivatedRoute, Router} from "@angular/router";
|
|
import {Fraction} from "../utils/fraction.enum";
|
|
|
|
|
|
@Component({
|
|
selector: 'army',
|
|
templateUrl: './army.component.html',
|
|
styleUrls: ['./army.component.css']
|
|
})
|
|
export class ArmyComponent {
|
|
|
|
army: Army = {BLUFOR: {squads: [], memberCount: 0}, OPFOR: {squads: [], memberCount: 0}};
|
|
|
|
BLUFOR: string = Fraction.BLUFOR;
|
|
|
|
OPFOR: string = Fraction.OPFOR;
|
|
|
|
constructor(private router: Router,
|
|
private route: ActivatedRoute,
|
|
private armyService: ArmyService) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.armyService.getArmy()
|
|
.subscribe(army => {
|
|
this.army = army;
|
|
});
|
|
};
|
|
|
|
select(memberId) {
|
|
this.router.navigate([{outlets: {'right': ['member', memberId]}}], {relativeTo: this.route});
|
|
}
|
|
|
|
}
|