Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="checkbox">
- <label>
- <input #saveUsername [(ngModel)]="saveUsername.selected" type="checkbox" data-toggle="toggle">Benutername speichern
- </label
- ></div>
- import { Component, OnInit } from '@angular/core';
- import { Router } from '@angular/router';
- import { Variables } from '../../services/variables';
- @Component({
- selector: 'login',
- moduleId: module.id,
- templateUrl: 'login.component.html',
- styleUrls: ['login.component.css']
- })
- export class LoginComponent implements OnInit {
- private saveUsername: boolean = true;
- private autoLogin: boolean = true;
- constructor(private router: Router, private variables: Variables) { }
- ngOnInit() {
- this.loginValid = false;
- // Hole Usernamen aus Local Storage falls gespeichert werden soll
- if (window.localStorage.getItem("username") === null) {
- this.saveUsername = true;
- this.autoLogin = true;
- console.log(this.saveUsername, this.autoLogin);
- } else {
- console.log("init", window.localStorage.getItem("username"));
- }
- }
- login(username: string, password: string, saveUsername: boolean, autoLogin: boolean) {
- this.variables.setUsername(username);
- this.variables.setPassword(password);
- this.variables.setIsLoggedIn(true);
- console.log(saveUsername, autoLogin);
- //this.router.navigate(['dashboard']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement