You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
925 B
39 lines
925 B
5 years ago
|
import { Component, OnInit } from '@angular/core'
|
||
|
import { Router, NavigationEnd } from '@angular/router'
|
||
|
import { Location } from '@angular/common'
|
||
|
import { ApisService } from '../services/apis.service'
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-detail',
|
||
|
templateUrl: './detail.component.html',
|
||
|
styleUrls: ['./detail.component.scss']
|
||
|
})
|
||
|
export class DetailComponent implements OnInit {
|
||
|
|
||
|
public details: any = {}
|
||
|
|
||
|
constructor(
|
||
|
private apisService: ApisService,
|
||
|
private router: Router,
|
||
|
private location: Location
|
||
|
){ }
|
||
|
|
||
|
ngOnInit(): void {
|
||
|
this.showDetails(this.router.url.split('/')[2])
|
||
|
}
|
||
|
|
||
|
showDetails(id): void {
|
||
|
this.apisService.getDetails(id).toPromise().then((response) => {
|
||
|
this.details = response.item
|
||
|
},(error) => {
|
||
|
console.error('getPortfolio ERROR', error)
|
||
|
}).catch((e) => {
|
||
|
console.error('getPortfolio CATCH', e)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
back() {
|
||
|
this.location.back()
|
||
|
}
|
||
|
}
|