-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
mentor-details.component.ts
40 lines (34 loc) · 1.04 KB
/
mentor-details.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { BreadcrumbService } from '@xng/xng-breadcrumb';
import { DataService } from '../../core/data.service';
@Component({
selector: 'bd-mentor-details',
templateUrl: './mentor-details.component.html',
styleUrls: ['./mentor-details.component.scss'],
})
export class MentorDetailsComponent implements OnInit {
mentor: { name: string };
constructor(
private breadcrumbService: BreadcrumbService,
private dataService: DataService,
private route: ActivatedRoute,
private router: Router
) {}
ngOnInit() {
this.getMentor();
}
getMentor() {
const mentorId = this.route.snapshot.paramMap.get('id');
this.dataService.getMentor(mentorId).subscribe((response) => {
this.mentor = response;
this.breadcrumbService.set('mentor/:id', this.mentor.name);
});
}
editMentor() {
this.router.navigate(['./edit'], {
relativeTo: this.route,
queryParams: { type: 'edit' },
});
}
}