Skip to content

Instantly share code, notes, and snippets.

@krejko
Created January 13, 2018 21:28
Show Gist options
  • Save krejko/144cc53b6074109ea2b7f4e05d920a59 to your computer and use it in GitHub Desktop.
Save krejko/144cc53b6074109ea2b7f4e05d920a59 to your computer and use it in GitHub Desktop.
Sample Login Service
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