import {Component, OnInit, OnDestroy} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {NotificationService as Service} from './notification.service'; @Component({ selector: 'app-view', templateUrl: './view.component.html', styleUrls: ['./view.component.scss'] }) export class ViewComponent implements OnInit, OnDestroy { constructor(public service: Service, private route: ActivatedRoute) { this.route.params.subscribe(params => this.service.params = params); } ngOnInit() { this.service.onInit(); } ngOnDestroy() { this.service.onDestroy(); } }