Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- import angular from 'angular';
- import uiRouter from 'angular-ui-router';
- import routes from './login.routes';
- export class LoginComponent {
- /*@ngInject*/
- constructor(Auth, $state) {
- this.Auth = Auth;
- this.$state = $state;
- this.errors = {login: ''};
- }
- login(form) {
- this.submitted = true;
- const user = {
- email: this.user.email,
- password: this.user.password
- };
- if (form.$valid) {
- this.Auth.login(user)
- .then(
- (data) => {
- this.errors.login = data;
- // Logged in, redirect to home
- //this.$state.go('main');
- },
- (err) => {
- this.errors.login = err;
- }
- );
- }
- }
- close() {
- this.submitted = false;
- this.errors = {};
- }
- }
- export default angular.module('sisaApp.login', [uiRouter])
- .config(routes)
- .component('login', {
- template: require('./login.html'),
- controller: LoginComponent
- })
- .name;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement