modal-one.component.ts 919 Bytes
import { Component, OnDestroy, OnInit } from '@angular/core';
import { SharedServiceService } from '../../services/shared-service.service';
import { Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';

@Component({
  selector: 'app-modal-one',
  templateUrl: './modal-one.component.html',
  styleUrls: ['./modal-one.component.css']
})
export class ModalOneComponent implements OnInit, OnDestroy {

  title: string;
  subscription: Subscription;

  constructor(private shared: SharedServiceService, private router: Router) {
    this.subscription = shared.title$.subscribe(title => {
      this.title = title;
    });
  }

  ngOnInit() {

  }

  btnChange() {
    this.shared.changedTitle('modal-one');
  }

  btnNext() {
    this.router.navigate(['/wizard', 2]);
  }

  btnClose() {
    this.router.navigate(['/wizard']);
  }

  ngOnDestroy() {
    this.subscription.unsubscribe();
  }
}