Skip to content

Instantly share code, notes, and snippets.

@dasmido
Created January 19, 2018 20:54
Show Gist options
  • Save dasmido/9f2da0d5e133b1bf948b72df6d9e5f0d to your computer and use it in GitHub Desktop.
Save dasmido/9f2da0d5e133b1bf948b72df6d9e5f0d to your computer and use it in GitHub Desktop.
import {AuthService} from '../../services/auth.service';
import {Router} from '@angular/router';
onRegisterSubmit(){
// Required Fields
// Required Fields for email
// Register user
this.authService.registerUser(user).subscribe(data => {
if(data.success) {
this.flashMessage.show('You ar now registered and can log in', {cssClass: 'alert-success', timeout: 3000});
this.router.navigate(['/login']);
} else {
this.flashMessage.show('Something went wrong!', {cssClass: 'alert-danger', timeout: 3000});
this.router.navigate(['/register']);
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment