Last change
on this file was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 3 months ago |
split group project and individual project into two separate folders
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | import {Component, OnInit} from '@angular/core';
|
---|
2 | import {ActivatedRoute} from "@angular/router";
|
---|
3 | import {RouteInstanceService} from "../../../services/route-instance/route-instance.service";
|
---|
4 | import {RouteInstanceResponse} from "../../../model/responses/RouteInstanceResponse";
|
---|
5 | import {MatButton} from "@angular/material/button";
|
---|
6 |
|
---|
7 | @Component({
|
---|
8 | selector: 'app-route-instance',
|
---|
9 | standalone: true,
|
---|
10 | imports: [
|
---|
11 | MatButton
|
---|
12 | ],
|
---|
13 | templateUrl: './route-instance.component.html',
|
---|
14 | })
|
---|
15 | export class RouteInstanceComponent implements OnInit {
|
---|
16 | routeInstance: RouteInstanceResponse | undefined
|
---|
17 |
|
---|
18 | constructor(private route: ActivatedRoute,
|
---|
19 | private routeInstanceService: RouteInstanceService,) {
|
---|
20 | }
|
---|
21 |
|
---|
22 | ngOnInit(): void {
|
---|
23 | const routeInstanceId: number = +this.route.snapshot.paramMap.get('id')!
|
---|
24 | this.routeInstanceService.getById(routeInstanceId).subscribe({
|
---|
25 | next: response => {
|
---|
26 | this.routeInstance = response
|
---|
27 | }
|
---|
28 | })
|
---|
29 |
|
---|
30 | }
|
---|
31 |
|
---|
32 | endInstance() {
|
---|
33 | if (this.routeInstance) {
|
---|
34 | this.routeInstanceService.stop(this.routeInstance.id).subscribe({
|
---|
35 | next: response => {
|
---|
36 | this.routeInstance = response
|
---|
37 | }
|
---|
38 | })
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.