Angular 6 dynamic form renderingCan't bind to 'formGroup' since it isn't a known property of 'form'angular2 using input to dynamically add to form modelNested forms in Angular 2 JS (RC4 and newer)What is the alternative of ControlGroup and Control in Angular2 GA/Final Release?Can't Reset Input Value Based on Select Field When Form Split into Child ComponentsAngular Material 2 nested form validation on submitangular 4 passing an object containing other objects into FormBuilder.group function leads to a strange form behaviorhow to trigger a validation of child component from parent component OnSubmit Angular 4?Angular preselect select inputRender Component html after form submitted in angularAngular 7 - How to show error messages in child components of form when submitting the form
Was Spock the First Vulcan in Starfleet?
Is there any reason not to eat food that's been dropped on the surface of the moon?
Lay out the Carpet
Is exact Kanji stroke length important?
Opposite of a diet
Why did Kant, Hegel, and Adorno leave some words and phrases in the Greek alphabet?
Products and sum of cubes in Fibonacci
Modify casing of marked letters
What is difference between behavior and behaviour
Star/Wye electrical connection math symbol
The baby cries all morning
Is it okay / does it make sense for another player to join a running game of Munchkin?
What to do with wrong results in talks?
How to verify if g is a generator for p?
How do I rename a LINUX host without needing to reboot for the rename to take effect?
There is only s̶i̶x̶t̶y one place he can be
How does a character multiclassing into warlock get a focus?
Are there any comparative studies done between Ashtavakra Gita and Buddhim?
Cynical novel that describes an America ruled by the media, arms manufacturers, and ethnic figureheads
Is a roofing delivery truck likely to crack my driveway slab?
Hide Select Output from T-SQL
What are the ramifications of creating a homebrew world without an Astral Plane?
Efficiently merge handle parallel feature branches in SFDX
Is the destination of a commercial flight important for the pilot?
Angular 6 dynamic form rendering
Can't bind to 'formGroup' since it isn't a known property of 'form'angular2 using input to dynamically add to form modelNested forms in Angular 2 JS (RC4 and newer)What is the alternative of ControlGroup and Control in Angular2 GA/Final Release?Can't Reset Input Value Based on Select Field When Form Split into Child ComponentsAngular Material 2 nested form validation on submitangular 4 passing an object containing other objects into FormBuilder.group function leads to a strange form behaviorhow to trigger a validation of child component from parent component OnSubmit Angular 4?Angular preselect select inputRender Component html after form submitted in angularAngular 7 - How to show error messages in child components of form when submitting the form
I want to build a form reading fields from a list of values:
<form [formGroup]="fileForm" (ngSubmit)="onSubmit(fileForm.value)">
<section class="col col-8">
<div>
<label *ngFor="let metadato of metadatiAbilitati" class="input">
<input type="text" placeholder="metadato.chiave"
[formControl]="fileForm.get(metadato.chiave)" />
</label>
</div>
<!-- <label class="input">
<input type="file" name="file" placeholder="seleziona file" />
</label> -->
</section>
<!-- <div> -->
<button type="submit">Aggiungi</button>
<!-- </div> -->
</form>
in component ts file I have:
constructor(private transazioneService: TransazioneService, fb: FormBuilder)
this.fileInputs = [];
let fields = ;
this.metadatiAbilitati.forEach(m =>
let input = this.fileForm.controls[`m.chiave`];
this.fileInputs.push(input);
fields[m.chiave] = m.chiave;
);
this.fileForm = fb.group(fields);
But from browser I got this error:

Finally, In main module I import ReactiveFormsModule.
Anyone can help me?
|
show 2 more comments
I want to build a form reading fields from a list of values:
<form [formGroup]="fileForm" (ngSubmit)="onSubmit(fileForm.value)">
<section class="col col-8">
<div>
<label *ngFor="let metadato of metadatiAbilitati" class="input">
<input type="text" placeholder="metadato.chiave"
[formControl]="fileForm.get(metadato.chiave)" />
</label>
</div>
<!-- <label class="input">
<input type="file" name="file" placeholder="seleziona file" />
</label> -->
</section>
<!-- <div> -->
<button type="submit">Aggiungi</button>
<!-- </div> -->
</form>
in component ts file I have:
constructor(private transazioneService: TransazioneService, fb: FormBuilder)
this.fileInputs = [];
let fields = ;
this.metadatiAbilitati.forEach(m =>
let input = this.fileForm.controls[`m.chiave`];
this.fileInputs.push(input);
fields[m.chiave] = m.chiave;
);
this.fileForm = fb.group(fields);
But from browser I got this error:

Finally, In main module I import ReactiveFormsModule.
Anyone can help me?
did you add formsModule in your main module?
– Naieem Mahmud Supto
Mar 7 at 11:42
2
possible duplication of this... stackoverflow.com/questions/39152071/…
– Naieem Mahmud Supto
Mar 7 at 11:44
No, I Didn't. Is formModule use for template-driven solution? I don't want to use that.
– Vitto Lib
Mar 7 at 11:50
Yes formModule is must when you use form in your template
– Naieem Mahmud Supto
Mar 7 at 11:53
I have also imported FormsModule, but It still doesn't work.
– Vitto Lib
Mar 7 at 12:00
|
show 2 more comments
I want to build a form reading fields from a list of values:
<form [formGroup]="fileForm" (ngSubmit)="onSubmit(fileForm.value)">
<section class="col col-8">
<div>
<label *ngFor="let metadato of metadatiAbilitati" class="input">
<input type="text" placeholder="metadato.chiave"
[formControl]="fileForm.get(metadato.chiave)" />
</label>
</div>
<!-- <label class="input">
<input type="file" name="file" placeholder="seleziona file" />
</label> -->
</section>
<!-- <div> -->
<button type="submit">Aggiungi</button>
<!-- </div> -->
</form>
in component ts file I have:
constructor(private transazioneService: TransazioneService, fb: FormBuilder)
this.fileInputs = [];
let fields = ;
this.metadatiAbilitati.forEach(m =>
let input = this.fileForm.controls[`m.chiave`];
this.fileInputs.push(input);
fields[m.chiave] = m.chiave;
);
this.fileForm = fb.group(fields);
But from browser I got this error:

Finally, In main module I import ReactiveFormsModule.
Anyone can help me?
I want to build a form reading fields from a list of values:
<form [formGroup]="fileForm" (ngSubmit)="onSubmit(fileForm.value)">
<section class="col col-8">
<div>
<label *ngFor="let metadato of metadatiAbilitati" class="input">
<input type="text" placeholder="metadato.chiave"
[formControl]="fileForm.get(metadato.chiave)" />
</label>
</div>
<!-- <label class="input">
<input type="file" name="file" placeholder="seleziona file" />
</label> -->
</section>
<!-- <div> -->
<button type="submit">Aggiungi</button>
<!-- </div> -->
</form>
in component ts file I have:
constructor(private transazioneService: TransazioneService, fb: FormBuilder)
this.fileInputs = [];
let fields = ;
this.metadatiAbilitati.forEach(m =>
let input = this.fileForm.controls[`m.chiave`];
this.fileInputs.push(input);
fields[m.chiave] = m.chiave;
);
this.fileForm = fb.group(fields);
But from browser I got this error:

Finally, In main module I import ReactiveFormsModule.
Anyone can help me?
asked Mar 7 at 11:39
Vitto LibVitto Lib
137
137
did you add formsModule in your main module?
– Naieem Mahmud Supto
Mar 7 at 11:42
2
possible duplication of this... stackoverflow.com/questions/39152071/…
– Naieem Mahmud Supto
Mar 7 at 11:44
No, I Didn't. Is formModule use for template-driven solution? I don't want to use that.
– Vitto Lib
Mar 7 at 11:50
Yes formModule is must when you use form in your template
– Naieem Mahmud Supto
Mar 7 at 11:53
I have also imported FormsModule, but It still doesn't work.
– Vitto Lib
Mar 7 at 12:00
|
show 2 more comments
did you add formsModule in your main module?
– Naieem Mahmud Supto
Mar 7 at 11:42
2
possible duplication of this... stackoverflow.com/questions/39152071/…
– Naieem Mahmud Supto
Mar 7 at 11:44
No, I Didn't. Is formModule use for template-driven solution? I don't want to use that.
– Vitto Lib
Mar 7 at 11:50
Yes formModule is must when you use form in your template
– Naieem Mahmud Supto
Mar 7 at 11:53
I have also imported FormsModule, but It still doesn't work.
– Vitto Lib
Mar 7 at 12:00
did you add formsModule in your main module?
– Naieem Mahmud Supto
Mar 7 at 11:42
did you add formsModule in your main module?
– Naieem Mahmud Supto
Mar 7 at 11:42
2
2
possible duplication of this... stackoverflow.com/questions/39152071/…
– Naieem Mahmud Supto
Mar 7 at 11:44
possible duplication of this... stackoverflow.com/questions/39152071/…
– Naieem Mahmud Supto
Mar 7 at 11:44
No, I Didn't. Is formModule use for template-driven solution? I don't want to use that.
– Vitto Lib
Mar 7 at 11:50
No, I Didn't. Is formModule use for template-driven solution? I don't want to use that.
– Vitto Lib
Mar 7 at 11:50
Yes formModule is must when you use form in your template
– Naieem Mahmud Supto
Mar 7 at 11:53
Yes formModule is must when you use form in your template
– Naieem Mahmud Supto
Mar 7 at 11:53
I have also imported FormsModule, but It still doesn't work.
– Vitto Lib
Mar 7 at 12:00
I have also imported FormsModule, but It still doesn't work.
– Vitto Lib
Mar 7 at 12:00
|
show 2 more comments
1 Answer
1
active
oldest
votes
Finally, I have solved my problem. Chrome was caching previous changes, so I didn't see right fix.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55042918%2fangular-6-dynamic-form-rendering%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Finally, I have solved my problem. Chrome was caching previous changes, so I didn't see right fix.
add a comment |
Finally, I have solved my problem. Chrome was caching previous changes, so I didn't see right fix.
add a comment |
Finally, I have solved my problem. Chrome was caching previous changes, so I didn't see right fix.
Finally, I have solved my problem. Chrome was caching previous changes, so I didn't see right fix.
answered Mar 7 at 15:30
Vitto LibVitto Lib
137
137
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55042918%2fangular-6-dynamic-form-rendering%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you add formsModule in your main module?
– Naieem Mahmud Supto
Mar 7 at 11:42
2
possible duplication of this... stackoverflow.com/questions/39152071/…
– Naieem Mahmud Supto
Mar 7 at 11:44
No, I Didn't. Is formModule use for template-driven solution? I don't want to use that.
– Vitto Lib
Mar 7 at 11:50
Yes formModule is must when you use form in your template
– Naieem Mahmud Supto
Mar 7 at 11:53
I have also imported FormsModule, but It still doesn't work.
– Vitto Lib
Mar 7 at 12:00