Hello everyone!
I would like to use a modal in my form. I am aware that I should add
static get parameters(){
return [[NavController],[ViewController],[NavParams]];
};
How ever when I add this, to my form class, I get an error, “TypeError: formBuilder.group is not a function”
Any idea how to fix this?
Thanks,
Andrew
You need…
- ionic-angular beta 11
https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#200-beta11-2016-08-05
Follow this link if you already have an existing project.
-
Install the new forms module
-
Import FormBuilder from @angular/forms
import { FormBuilder } from '@angular/forms';
- Then inject it in the class
export class MyClass {
static get parameters(){
return [[NavController],[ViewController],[NavParams], [FormBuilder]];
};
constructor(navCtrl, viewCtrl, navParams, formBuilder){
this.formBuilder = formBuilder;
}
}
Thanks @mhartington.
I posted this with beta 10 installed, but have yet to try with beta 11. Hopefully it fixed the issue. Will update this post when I do!
Andrew
Follow Up for Googlers:
I did not pursue this route. Instead, I moved my FormGroup into a service much like the Angular2 dynamic forms tutroial.
Its cleaner and more modular this way.