1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { Component, OnInit, ViewChild } from '@angular/core';
import { IonSlides } from '@ionic/angular';
import { Router, ActivatedRoute } from '@angular/router';
import { ServiceService } from './../../config/service.service';
import { SubjectService } from './../../config/subject.service';
@Component({
selector: 'app-landing',
templateUrl: './landing.page.html',
styleUrls: ['./landing.page.scss']
})
export class LandingPage implements OnInit {
loader: boolean;
constructor(
private router: Router,
private route: ActivatedRoute,
private service: ServiceService,
public subjectService: SubjectService
) {
this.loader = true;
this.service.get('landing').then(data => {
if (data === true) {
const user = JSON.parse(localStorage.getItem('user'));
console.log(user);
if (user) {
this.subjectService.sendLoginData(false);
this.goToPage('home');
} else {
this.subjectService.sendLoginData(true);
this.goToPage('login');
}
}
this.loader = false;
});
}
slideOpts = {
initialSlide: 0,
speed: 1000,
allowTouchMove: false
};
@ViewChild(IonSlides, { static: false }) slides: IonSlides;
currentIndex: any;
landingOptions = {
initialSlide: 1,
speed: 1000,
allowTouchMove: true
};
ngOnInit() {}
goToPage(path, data = null) {
this.service.set('landing', true);
this.router.navigateByUrl(path, { queryParams: data });
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
next() {
this.slides.slideNext();
}
prev() {
this.slides.slidePrev();
}
slideChanged() {
this.slides.getActiveIndex().then(index => {
this.currentIndex = index;
console.log(this.currentIndex);
});
}
}