|
@ -11,6 +11,8 @@ import { ApisService } from '../services/apis.service' |
|
|
export class DetailComponent implements OnInit { |
|
|
export class DetailComponent implements OnInit { |
|
|
|
|
|
|
|
|
public details: any = {} |
|
|
public details: any = {} |
|
|
|
|
|
public section: string = '' |
|
|
|
|
|
public id: number = 0 |
|
|
private history: string[] = [] |
|
|
private history: string[] = [] |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
@ -21,7 +23,9 @@ export class DetailComponent implements OnInit { |
|
|
) { } |
|
|
) { } |
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
ngOnInit(): void { |
|
|
this.showDetails(this.router.url.split('/')[2], this.router.url.split('/')[3]) |
|
|
|
|
|
|
|
|
this.section = this.router.url.split('/')[2] |
|
|
|
|
|
this.id = parseInt(this.router.url.split('/')[3]) |
|
|
|
|
|
this.showDetails(this.section, this.id) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
showDetails(section, id): void { |
|
|
showDetails(section, id): void { |
|
@ -41,7 +45,9 @@ export class DetailComponent implements OnInit { |
|
|
this.history.pop() |
|
|
this.history.pop() |
|
|
if(this.history.length > 0) { |
|
|
if(this.history.length > 0) { |
|
|
const last = this.history[this.history.length - 1] |
|
|
const last = this.history[this.history.length - 1] |
|
|
this.showDetails(last.split('/')[2], last.split('/')[3]) |
|
|
|
|
|
|
|
|
this.section = last.split('/')[2] |
|
|
|
|
|
this.id = parseInt(last.split('/')[3]) |
|
|
|
|
|
this.showDetails(this.section, this.id) |
|
|
this.location.back() |
|
|
this.location.back() |
|
|
} else { |
|
|
} else { |
|
|
this.location.back() |
|
|
this.location.back() |
|
|