import { Component , OnDestroy , OnInit } from '@angular/core' ; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' ; import { BehaviorSubject , Observable , Subscription , timer } from 'rxjs' ; import { SpecialService } from '../../../framework/services/special.service' ; @ Component ( { selector : 'cmdb-step-by-step-intro' , templateUrl : './step-by-step-intro.component.html' , styleUrls : [ './step-by-step-intro.component.scss' ] } ) export class StepByStepIntroComponent implements OnInit , OnDestroy { private readonly STEPS = 'steps' ; private readonly EXECUTE = 'execute' ; public introInstance = new BehaviorSubject < any [ ] > ( [ ] ) ; private subscription : Subscription ; private isReady : boolean = false ; constructor ( public activeModal , private specialService ) { } public ngOnInit ( ) { this . subscription = timer ( 0 , 1000 ) . subscribe ( result => { this . specialService . getIntroStarter ( ) . subscribe ( value => { this . introInstance . next ( value [ this . STEPS ] ) ; this . isReady = value [ this . EXECUTE ] ; } ) ; } ) ; } public checkValid ( ) { return this . isReady ; } ngOnDestroy ( ) { this . subscription . unsubscribe ( ) ; } }