angularjs - Angular dynamic form for array of strings -
i've got news multiple paragraphs in it. i'm trying add form control each paragraphs can update them individually.
this how data looks like
{ "newsid": "42352", "title": "service available", "body": [ "lorem ipsum has more-or-less normal distribution of letters, opposed", "lorem ipsum has more-or-less normal distribution of letters, opposed", ], "id": 1 }
my template looks
<div class="form-group" > <md-input-container class="md-block"> <textarea mdinput type="text" rows="6" cols="" [ngmodel]="news?.getbody()" class="texta" name="body" placeholder="paragraph" #body [formcontrol]="updatenewsformgroup.controls['body']"></textarea> </md-input-container> </div>
in component i've
this.updatenewsformgroup = formbuilder.group({ 'title': ['', validators.compose([validators.required, validators.minlength(3), validators.maxlength(50)])], 'body': ['', validators.compose([validators.required, validators.minlength(3)])], 'newparagraph': ['', validators.compose([validators.required, validators.minlength(3)])] });
how can assign controller each paragraphs individually?
Comments
Post a Comment