File

src/app/pages/photo-detail-page/photo-detail-page.component.ts

Description

Photo detail page component

Implements

OnInit OnDestroy

Example

Metadata

selector app-photo-detail-page
styleUrls photo-detail-page.component.scss
templateUrl ./photo-detail-page.component.html

Index

Properties
Methods

Constructor

constructor(router: ActivatedRoute)
Parameters :
Name Type Optional Description
router ActivatedRoute

Methods

ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

Private id
id: string
Type : string
Private log
log:
Default value : Log.create('PhotoDetailPageComponent')
Private sub
sub: any
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>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""