I have developed a signup page using Ionic 2. In this signup page, I have included a dropdown menu for users to select their blood type. However, I am facing an issue where the selected blood type is not being sent to the Backand database as expected. I'm unsure of what mistake I might be making that is causing this problem.
signup.ts
import {Component} from '@angular/core';
import { BackandService } from '@backand/angular2-sdk'
import { LoginPage } from '../login/login';
import { AlertController } from 'ionic-angular';
@Component({
templateUrl: 'signup.html',
selector: 'page-signup',
})
export class SignupPage {
email:string = '';
firstName:string = '';
lastName:string = '';
signUpPassword: string = '';
confirmPassword: string = '';
bloodType: Object = {};
constructor(private backand: BackandService, private alertCtrl:
AlertController) {}
public signUp() {
this.backand.signup(this.firstName, this.lastName, this.email,this.signUpPassword, this.confirmPassword, this.bloodType)
.then((res: any) =>
{
let alert = this.alertCtrl.create({
subTitle: 'Thank you for signing up.',
buttons:['Login']
});
alert.present();
this.email = this.signUpPassword = this.confirmPassword = this.firstName= this.lastName = this.bloodType = '';
}
);
}
}
signup.html
<ion-item>
<ion-label>Select Your Blood Type</ion-label>
<ion-select type="text" (input)="bloodType = $event.target.value" ng-model="bloodType">
<ion-option>O Positive</ion-option>
<ion-option> O Negative</ion-option>
<ion-option> A Positive</ion-option>
<ion-option> A Negative</ion-option>
<ion-option> B Positive</ion-option>
<ion-option> B Negative</ion-option>
<ion-option> AB Positive</ion-option>
<ion-option> AB Negative</ion-option>
<ion-option> Unknown</ion-option>
</ion-select>
<ion-item>