import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {LearningListPage} from "../learning-list/learning-list";
import {LearnService} from "../learn.service";

@IonicPage()
@Component({
  selector: 'page-rank',
  templateUrl: 'rank.html',
})
export class RankPage {

  list = [];
  constructor(public navCtrl: NavController, public navParams: NavParams,
              private learnSer:LearnService) {
  }

  ionViewDidLoad() {
      const testId = this.navParams.get('testId');
      this.learnSer.getTop5(testId).subscribe(
          (res)=>{
                this.list = res.top5;
          }
      )
    console.log('ionViewDidLoad RankPage');
  }

    root(){
      this.navCtrl.setRoot(LearningListPage)
        console.log(this.navCtrl.getViews())
    }

}
