Skip to content

Instantly share code, notes, and snippets.

@avatsaev
Last active February 12, 2017 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avatsaev/9cc3e39324fe71915e3ef07ef1d1795f to your computer and use it in GitHub Desktop.
Save avatsaev/9cc3e39324fe71915e3ef07ef1d1795f to your computer and use it in GitHub Desktop.
import {Component, OnInit, EventEmitter, Output} from '@angular/core';
import {Angular2TokenService} from "angular2-token";
@Component({
selector: 'app-register-form',
templateUrl: './register-form.component.html',
styleUrls: ['./register-form.component.sass']
})
export class RegisterFormComponent implements OnInit {
signUpUser = {
email: '',
password: '',
passwordConfirmation: ''
};
@Output() onFormResult = new EventEmitter<any>();
constructor(private tokenAuthSerivce:Angular2TokenService) { }
ngOnInit() {}
onSignUpSubmit(){
this.tokenAuthSerivce.registerAccount(this.signUpUser).subscribe(
(res) => {
if (res.status == 200){
this.onFormResult.emit({signedUp: true, res})
}
},
(err) => {
console.log(err.json())
this.onFormResult.emit({signedUp: false, err})
}
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment