This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
FoodLoop-Web/src/app/pages/register.component.ts
2017-05-09 13:39:48 +01:00

40 lines
No EOL
1.1 KiB
TypeScript

import { Component } from '@angular/core';
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
import { Http, Response } from '@angular/http';
import { ApiService } from '../providers/api-service';
import 'rxjs/add/operator/map';
@Component({
templateUrl: 'register.component.html',
providers: [ApiService]
})
export class RegisterComponent {
signup: FormGroup;
ageRanges: Object[];
constructor(private http: Http, private formBuilder: FormBuilder, private api: ApiService) {
this.api.getAgeRanges().subscribe(
result => {
console.log(result);
this.ageRanges = result.ages;
}
)
this.signup = this.formBuilder.group({
token: ['', [Validators.required]],
full_name: ['', [Validators.required]],
display_name: ['', [Validators.required]],
email: ['', [Validators.required]],
postcode: ['', [Validators.required]],
age_range: ['', [Validators.required]],
password: ['', [Validators.required]],
});
}
onSubmit() {
console.log(this.signup.value);
}
}