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

40 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
2017-05-09 13:39:48 +01:00
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
2017-04-27 22:50:11 +01:00
import { Http, Response } from '@angular/http';
2017-05-09 13:39:48 +01:00
import { ApiService } from '../providers/api-service';
import 'rxjs/add/operator/map';
@Component({
2017-05-09 13:39:48 +01:00
templateUrl: 'register.component.html',
providers: [ApiService]
})
export class RegisterComponent {
2017-05-09 13:39:48 +01:00
signup: FormGroup;
ageRanges: Object[];
constructor(private http: Http, private formBuilder: FormBuilder, private api: ApiService) {
2017-04-27 22:50:11 +01:00
2017-05-09 13:39:48 +01:00
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);
2017-04-27 22:50:11 +01:00
}
2017-05-09 13:39:48 +01:00
}