1 import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
2 // import { ToolbarService } from './../toolbar/toolbar.service';
4 import { Router, ActivatedRoute } from '@angular/router';
5 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
7 import { AuthenticationService } from '../_services/authentication.service';
8 import { EliotserviceService } from '../eliotservice.service';
9 declare var particlesJS: any;
12 selector: 'app-login',
13 templateUrl: './login.component.html',
14 styleUrls: ['./login.component.scss']
16 export class LoginComponent implements OnInit {
30 private formBuilder: FormBuilder,
31 private route: ActivatedRoute,
32 private router: Router,
33 private authenticationService: AuthenticationService,
34 private eliotService: EliotserviceService
41 this.loginForm = this.formBuilder.group({
42 email: ['', Validators.required],
43 password: ['', Validators.required]
46 particlesJS.load('particles-js', './../../assets/particlesjs-config.json', function() {
47 console.log('callback - particles.js config loaded');
51 get fval() { return this.loginForm.controls; }
54 console.log("Inside onFormSubmit() ....")
55 this.submitted = true;
56 if (this.loginForm.invalid) {
57 console.log("Login Form invalid...")
63 this.eliotService.getRoleName()
67 sessionStorage.setItem('roleName',data.roleName);
70 this.router.navigate(['/']);
72 this.authenticationService.login(this.fval.email.value, this.fval.password.value)
75 sessionStorage.setItem('roleName',this.roles.role);
76 this.router.navigate(['/']);