I created a component which is generating a form according to the current page:
<div *ngIf="checkCurrentDetails() == 'Dimension'" >
<form [formGroup]="form">
<div formGroupName="name">
<input formControlName="first" placeholder="First">
<input formControlName="last" placeholder="Last">
</div>
<input formControlName="email" placeholder="Email">
<button>Submit</button>
</form>
<p>Value: {{ form.value | json }}</p>
<p>Validation status: {{ form.status }}</p>
</div>
<div *ngIf="checkCurrentDetails() == 'Dimension Attributes'" >
<form [formGroup]="form">
<div formGroupName="name">
<input class="search" formControlName="first" placeholder="First">
<input formControlName="last" placeholder="Last">
</div>
<input formControlName="email" placeholder="Email">
<button>Submit</button>
</form>
<p>Value: {{ form.value | json }}</p>
<p>Validation status: {{ form.status }}</p>
</div>
With this test method:
checkCurrentDetails(){
if(this.currentDetails['site'] == 'Dimension Attributes'){
this.form = this.fb.group({
name: this.fb.group({
first: ['Nancy', Validators.minLength(2)],
last: 'Drew',
}),
email: '',
});
return this.currentDetails['site'];
}
if(this.currentDetails['site'] == 'Dimension'){
this.form = this.fb.group({
name: this.fb.group({
first: ['Nanci', Validators.minLength(2)],
last: 'Drew',
}),
email: '',
});
return this.currentDetails['site'];
}
}
it is generating the form according to the site very well and it is producing this form:
http://www.pic-upload.de/view-32540301/test.jpg.html
In the textboxes youll be able to see the predefined test content. For example first textbox :"Nanci" etc. But now to my problem. I am not able to type in ,change or insert text to these textboxes. It seems like something is blocking it.
So I tried another thing to test if it has something to do with the form. I created a textbox
<input type='text'>
outside the form, which is working well. I am able to input text to this box but not to the textboxes inside the form and I don't know why?
valueChangesnot get triggered?