src/app/pages/photo-detail-page/photo-detail-page.component.ts
Photo detail page component
selector | app-photo-detail-page |
styleUrls | photo-detail-page.component.scss |
templateUrl | ./photo-detail-page.component.html |
Properties |
Methods |
constructor(router: ActivatedRoute)
|
||||||||
Parameters :
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Private id |
id:
|
Type : string
|
Private log |
log:
|
Default value : Log.create('PhotoDetailPageComponent')
|
Private sub |
sub:
|
Type : any
|
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Log } from 'ng2-logger';
/**
* Photo detail page component
* @author Daniel Sogl
*/
@Component({
selector: 'app-photo-detail-page',
templateUrl: './photo-detail-page.component.html',
styleUrls: ['./photo-detail-page.component.scss']
})
export class PhotoDetailPageComponent implements OnInit, OnDestroy {
private log = Log.create('PhotoDetailPageComponent');
private sub: any;
private id: string;
constructor(private router: ActivatedRoute) {}
ngOnInit() {
this.log.color = 'orange';
this.log.d('Component initialized');
this.sub = this.router.params.subscribe(params => {
this.id = params['id'];
});
}
ngOnDestroy() {
this.sub.unsubscribe();
}
}
<div class="row mt-5 pt-5">
<div class="col text-center">
<h1>Photo Detail Page</h1>
</div>
</div>