Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- class LoginController {
- constructor(Auth, $state) {
- this.user = {};
- this.errors = {};
- this.submitted = false;
- this.Auth = Auth;
- this.$state = $state;
- }
- login(form) {
- this.submitted = true;
- if (form.$valid) {
- this.Auth.login({
- email: this.user.email,
- password: this.user.password
- })
- .then(() => {
- // Logged in, redirect to home
- this.$state.go('main');
- })
- .catch(err => {
- this.errors.other = err.message;
- });
- }
- }
- }
- angular.module('lolstatsApp')
- .controller('LoginController', LoginController);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement