187
rated 0 times
[
192]
[
5]
/ answers: 1 / hits: 6246
/ 7 Years ago, mon, january 22, 2018, 12:00:00
putting together a simple form, and upon submission I am getting the following error:
ERROR TypeError: _this.form.get is not a function
at VM46 vendor.js:29003
at Array.forEach (<anonymous>)
at FormGroupDirective._updateDomValue (VM46 vendor.js:29002)
at FormGroupDirective.ngOnChanges (VM46 vendor.js:28820)
at checkAndUpdateDirectiveInline (VM46 vendor.js:12445)
at checkAndUpdateNodeInline (VM46 vendor.js:13951)
at checkAndUpdateNode (VM46 vendor.js:13894)
at debugCheckAndUpdateNode (VM46 vendor.js:14766)
at debugCheckDirectivesFn (VM46 vendor.js:14707)
at Object.View_FeedformPage_0._co [as updateDirectives] (VM145
The function that I am running is very simple... I am just trying to log the value of the form to the console at the moment (which it does) but I am still throwing an error, which I need to address. My imports/function is as follows :
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
constructor(public navCtrl: NavController, public navParams: NavParams,
public viewCtrl: ViewController, private formBuilder: FormBuilder,
public storage: Storage) {
this.feedForm = this.formBuilder.group({
description: ['', [Validators.required, Validators.minLength(2), Validators.maxLength(250)]]
});
}
addFeed(){
this.feedForm = this.feedForm.value;
console.log(this.feedForm);
}
The HTML is as follows:
<form [formGroup]=feedForm (ngSubmit)=addFeed()>
<ion-item>
<ion-label stacked>Update: </ion-label>
<ion-textarea formControlName=description placeholder=Leave Comment Here...></ion-textarea>
</ion-item>
<button ion-button type=submit [disabled]=!feedForm.valid>Update</button>
</form>
The fact that I cannot find anything to reference except this tells me that I am overlooking something obvious. Any insight would be appreciated.
More From » angular