Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

45 lines (36 sloc) 1.06 KB
import { Component, OnInit } from '@angular/core';
import { NgxSpinnerService } from 'ngx-spinner';
import { finalize } from 'rxjs/operators'
import { AuthService } from '../../core/authentication/auth.service';
import { UserRegistration } from '../../shared/models/user.registration';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit {
success: boolean;
error: string;
userRegistration: UserRegistration = { name: '', email: '', password: ''};
submitted: boolean = false;
constructor(private authService: AuthService, private spinner: NgxSpinnerService) {
}
ngOnInit() {
}
onSubmit() {
this.spinner.show();
this.authService.register(this.userRegistration)
.pipe(finalize(() => {
this.spinner.hide();
}))
.subscribe(
result => {
if(result) {
this.success = true;
}
},
error => {
this.error = error;
});
}
}
You can’t perform that action at this time.