question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FormArray usecase

See original GitHub issue

First of all, nice work! Really.

I was having a look at your Droids/Vehicles example, and a question emerged. What do I do if I need to handle a FormArray? An example to clarify: what if I want the user to be able to pick multiple colors for a Spaceship? I’ll have to deal with multiple (1...N) color picker. This is one thing missing from the README.

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
maxime1992commented, Jun 16, 2019

Hi @AdditionAddict,

another version passing formgroups to subcomponents directly https://stackblitz.com/edit/angular-author-book-chapter-demo-rvk27f0-separate

I’ve just finished to write a blog post about how to manage complex forms and I’m explaining there why passing a formGroup as an input is in my opinion not a good idea. I’ll let you go through the article if you want to know more https://dev.to/maxime1992/building-scalable-robust-and-type-safe-forms-with-angular-3nf9

About your example, I’ve been trying to build it and yes I’m also stuck with the array.

I planned to get back on that issue a week or two ago but a PR was pending (CF https://github.com/cloudnc/ngx-sub-form/pull/41) and I didn’t want to start a new one until that one was done. I guess it can/will be prioritised now 😃

I’ll come back to you as soon as the work is done with a demo for your example 👍

1reaction
maxime1992commented, Jun 18, 2019

@AdditionAddict I’ve been working yesterday and this morning onto that feature.

I’ve got a branch here https://github.com/cloudnc/ngx-sub-form/tree/feat/form-array where I’m nearly done but I miss a few tests and a bit of cleanup too.

Can’t have a look at that until tonight but I think it’ll take me until the end of the week to finish that one up so if you can wait I’d recommend you to, otherwise just clone my branch locally and build the library then use it in your own project like that for a few days. I highly doubt the public API will change it’ll be mostly tests and cleanup now. But once again if you can wait a few days it’ll be easier and I also have a repro of your demo just waiting that the branch I’m working on is published 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular FormArray - Complete Guide
We are going to give an example of a common use case that would be hard to implement without a FormArray : an...
Read more >
Working with Angular FormArray - JScrambler Blog
In this post, we'll teach you how to use the Angular FormArray to add dynamic data into the Angular form and validate it....
Read more >
Angular 10 Tutorial #69 - Reactive Forms - FormArray - YouTube
Angular 10 Tutorial formarray, Angular 11 Tutorial, Angular reactive form formarray, form controls tutorial, Reactive form formArray example ...
Read more >
Angular: N Level FormArray With Reactive Form Validation
All forms contain N details and distinct fields, as well as dynamic validation when data is entered. Use case image. Prerequisites. Prior ...
Read more >
How to use parent radio form control in form array reactive ...
I have a formControl (Radio) in parent formGroup and wanted to use it within formArray . Usecase is MCQ Question is having multiple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found