import { ExerciseService } from '../../shared/exercise.service' ; import { Component , OnInit , OnDestroy } from '@angular/core' ; import { SkipExercise } from './skip-exercise' ; import { TranslateService } from '@ngx-translate/core' ; import { Subscription } from 'rxjs' ; @ Component ( { selector : 'app-skip' , templateUrl : './skip.component.html' , styleUrls : [ './skip.component.scss' ] } ) export class SkipComponent implements OnInit , OnDestroy { exerciseTitle = 'skip' ; skipCode = `
  of(1, 2, 3, 4).pipe(
    skip(1)
  ).subscribe(data => console.log(data));

  // Logs:
  // 2
  // 3
  // 4
  ` ; currentLanguage = '' ; onLangChangeSubscription : Subscription ; constructor ( private exerciseService , private translateService ) { } ngOnInit ( ) { this . exerciseService . newExercise ( new SkipExercise ( ) ) ; this . currentLanguage = this . translateService . currentLang ; this . onLangChangeSubscription = this . translateService . onLangChange . subscribe ( { next : ( ) => { this . currentLanguage = this . translateService . currentLang ; } } ) ; } ngOnDestroy ( ) { this . onLangChangeSubscription . unsubscribe ( ) ; } }