All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.app.core.components.parent.parent.component.ts Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
import { Component } from '@angular/core';
import { Subscription } from 'rxjs';

import { LinkifierService, LoginService } from '@core/services';

@Component({
  selector: 'chutney-parent',
  templateUrl: './parent.component.html',
  styleUrls: ['./parent.style.scss'],
})
export class ParentComponent {

  private linkifierSubscription: Subscription;

  constructor(
    private linkifierService: LinkifierService,
    private loginService: LoginService
  ) {
    this.linkifierSubscription = this.loginService.getUser().subscribe(
        user => {
            if (this.loginService.isAuthenticated()) {
                this.linkifierService.loadLinkifiers().subscribe(); // needed to fetch linkifiers into sessionStorage
            }
        }
    );
  }

  ngOnDestroy() {
    if (this.linkifierSubscription) {
        this.linkifierSubscription.unsubscribe();
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy