import { Component } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router';
import {MyserviceService} from '../myservice.service'
@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
 student_data:any
  constructor(
    private router: Router,
    private route: ActivatedRoute,
    public myservice:MyserviceService
    ) {
      this.get_students_data();
    }

    details
  
  goToPage(path,data){
    console.log(data)
    //this.router.navigateByUrl(path);
    this.router.navigateByUrl('/details/'+data);
    document.body.scrollTop = document.documentElement.scrollTop = 0;
  }
get_students_data(){
  var This= this
  console.log('Homepage')
  this.myservice.presentLoader()
  this.myservice.load_get('student_data').subscribe (resp=> {
   This.myservice.dismissLoader();
    console.log(resp);
    this.student_data = resp.data;
    console.log(this.student_data);
  });
  }
  logout() {
    console.log('Logout')
    this.router.navigateByUrl('/login',{replaceUrl: true});
    document.body.scrollTop = document.documentElement.scrollTop = 0;
  }
 
}
