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.

38 lines
1008 B

import { Component, OnInit } from '@angular/core'
5 years ago
import { Router, NavigationEnd } from '@angular/router'
import { ApisService } from '../services/apis.service'
@Component({
selector: 'app-portfolio',
templateUrl: './portfolio.component.html',
styleUrls: ['./portfolio.component.scss']
})
export class PortfolioComponent implements OnInit {
public portfolioItems: any = []
public section: string = ''
5 years ago
constructor(
private apisService: ApisService,
private router: Router)
{ }
ngOnInit(): void {
this.section = this.router.url.split('/')[1]
this.apisService.getPortfolio(this.section).toPromise().then((response) => {
this.portfolioItems = response.items
},(error) => {
console.error('getPortfolio ERROR', error)
}).catch((e) => {
console.error('getPortfolio CATCH', e)
})
}
5 years ago
showDetails(id): void {
const section = this.section == 'exhibitions' ? 'exhibitions' : 'works'
this.router.navigate([`/detail/${section}/${id}`])
5 years ago
}
}