interactive-mining/interactive-mining-angular-.../src/app/stepsnvabar/stepsnvabar.component.ts

42 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-02-28 12:41:06 +01:00
import { Component, OnInit } from '@angular/core';
2018-03-17 14:05:55 +01:00
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router';
2018-02-28 12:41:06 +01:00
@Component({
selector: 'app-stepsnvabar',
templateUrl: './stepsnvabar.component.html',
styleUrls: ['./stepsnvabar.component.css']
})
export class StepsnvabarComponent implements OnInit {
private proccessStep = 0;
2018-03-17 14:05:55 +01:00
constructor(private route: ActivatedRoute, private router: Router) {
2018-02-28 12:41:06 +01:00
router.events.subscribe((val) => {
// see also
if (val instanceof NavigationEnd) {
this.changeStep(val.urlAfterRedirects);
}
});
}
ngOnInit() {}
changeStep(url: string): void {
2018-03-17 14:05:55 +01:00
console.log(url);
if (url.endsWith('upload-content')) {
2018-02-28 12:41:06 +01:00
this.proccessStep = 1;
2018-03-17 14:05:55 +01:00
} else if (url.endsWith('configure-profile')) {
2018-02-28 12:41:06 +01:00
this.proccessStep = 2;
2018-03-17 14:05:55 +01:00
} else if (url.endsWith('save-profile')) {
2018-02-28 12:41:06 +01:00
this.proccessStep = 3;
} else {
this.proccessStep = 0;
}
}
2018-03-08 11:19:06 +01:00
cancelHandle(): void {
2018-03-17 14:05:55 +01:00
this.router.navigate(['../manage-profiles'], {relativeTo: this.route});
2018-03-08 11:19:06 +01:00
}
2018-02-28 12:41:06 +01:00
}