-
Couldn't load subscription status.
- Fork 3
Data Model: Wizard
The data for the questionnaire will be in an object. There will be a total of 10 properties that are obtained from the answers that the user inputs.
- branch:
-
data type: String
-
required: true
- veteranOrActive:
-
data type: String
-
required: true
- separationDate:
-
data type: Date
-
required: true
- disabilityStatus:
-
data type: String
-
required: true
- disabilityPercent:
-
data type: Number
-
required: Optional/Conditional
- employmentStatus:
-
data type: String?
-
required: true
- lastEmployed:
-
data type: Date
-
required: Optional/Conditional
- maritalStatus:
-
data type: String
-
required: true
- militaryRank:
-
data type: String
-
required: true
- MOS:
-
data type: string
-
required: true
To make the UserData object, the properties are set to the value of the FormControl value which is obtained from the FormGroup. (Discussed in the Wizard Documentation).
The value property gives us the value of the FormControl once the input is valid.
After the user clicks the submit button on the last questionnaire, the onSubmit() method is called and sets the object properties value.
The onSubmit method, after it sets the properties value, calls a method in the service that 'puts' data to the database.
onSubmit() {
let userData: object = {
branch: this.firstForm.value.branch,
veteranOrActive: this.firstForm.value.vetOrActive,
separationDate: this.firstForm.value.separationDate,
disabilityStatus: this.firstForm.value.disability,
disabilityPercent: this.firstForm.value.percentQuestion,
employmentStatus: this.secondForm.value.employment,
lastEmployed: this.secondForm.value.lastEmployed,
marriageStatus: this.secondForm.value.marriage,
militaryRank: this.thirdForm.value.rank,
MOS: this.thirdForm.value.MOS
}
this._user.putData(userData)
.subscribe(data =>{
})
}
https://docs.google.com/drawings/d/1zgqj4_t2Mqu1Ihe6PovRvpMlnILgDlDgj5yeHb0jIGc/edit?usp=sharing