Created
January 13, 2018 21:28
-
-
Save krejko/144cc53b6074109ea2b7f4e05d920a59 to your computer and use it in GitHub Desktop.
Sample Login Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
@Injectable() | |
export class LoginService { | |
constructor() { } | |
testUser = {username: 'tester', password: 'password'}; | |
loggedIn = false; | |
isLoggedIn() { | |
return this.loggedIn; | |
} | |
login(username, password) { | |
if (username === this.testUser.username && password === this.testUser.password) { | |
this.loggedIn = true; | |
} | |
return this.isLoggedIn(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment