A growing list with FormArray in Angular

Angular interview exercise on Forms, difficulty 3 of 3. Solve it in the editor beside a worked example; the tests run the moment you do.

PhonesComponent keeps phone numbers in a FormArray named `phones` inside `form`, starting empty. <button class="add"> appends an empty control; each entry is an <input class="phone"> with a <button class="remove"> beside it; <p class="count"> says "N numbers". Numbers are required, so the form is invalid while one is empty.

Each exercise pairs a worked example with a twin problem to solve in a real editor; the tests run the moment you do. Progress is saved in your browser, and in your account if you sign in.

More Forms in Angular

All Angular exercises · Other languages and frameworks