Hello!
–v2
I am trying to create a simple form inside a modal that takes the information the user entered and displays it in the previous page. I have called the form: addform and the home page: mhome.
My form calls the closeModal() function:
export class Addform {
private addform : FormGroup;
constructor(private formBuilder: FormBuilder, public storage: Storage,public navCtrl: NavController, public viewCtrl: ViewController) {
this.addform = this.formBuilder.group({
name: ['', Validators.required],
occupation: [''],
dob: [''],
relationship: [''],
color: [''],
adjectives: [''],
});
}
closeModal(){
// this.navCtrl.push(MhomePage,this.addform);
// console.log();
// let data = this.addform;
**let data = this.addform;** //This is the part I'm confused on. How do I set the formbuilder group variables to the data variable?
this.viewCtrl.dismiss();
}
The openModal() function
openModal() {
let modal = this.modalCtrl.create(Addform);
modal.onDidDismiss((data) => {
console.log("Data =>", data);
});
modal.present();
}
Hitting the + button pops open the form page. The console shows that the data is undefined.
Any help would be appreciated!