Skip to content

fix(dynamic-forms): dynamically add, edit, remove Form Controls#787

Merged
emoralesb05 merged 13 commits into
developfrom
feature/624-dynamic-forms
Aug 9, 2017
Merged

fix(dynamic-forms): dynamically add, edit, remove Form Controls#787
emoralesb05 merged 13 commits into
developfrom
feature/624-dynamic-forms

Conversation

@jerryorta-dev

@jerryorta-dev jerryorta-dev commented Jul 25, 2017

Copy link
Copy Markdown
Contributor

Description

Per issue #624 reported, the td-dynamic-forms component did not allow having it's elements array changes after view rendered.

The issue is caused by manually building Form Controls structure provided based elements config array, causing race conditions and reference errors as the elements array is changed after view render.

The fix is to use the FormArray API to add, edit, and remove Form Controls after View Render. As the elements config array changes during runtime, the FormArray adds, removes, and changes Form Controls as needed.

There are no breaking changes.

What's included?

At test branch with a form to add, remove, edit Form Controls is provided.

Research:

Test Steps

  • git checkout feature/624-dynamic-forms
  • run ng lint
  • run npm test or ng test
  • run ng serve
  • navigate to http://localhost:4200/#/bug-624
  • Play with build your own form demo

General Tests for Every PR

  • ng serve --aot still works.
  • npm run lint passes.
  • npm test passes and code coverage is not lower.
  • npm run build still works.
Screenshots

build-your-own-form

closes #624

@emoralesb05

Copy link
Copy Markdown
Contributor
  • chore(): simplify code by adding/removing controls and forcing a manual refresh (refresh method)
  • chore(dynamic-forms): load README.md and add refresh method to its API
  • feat(dynamic-forms): make flex width % configurable via element interface
  • feat(dynamic-forms): add demo to build your own form

@emoralesb05 emoralesb05 changed the title fix(dynamic-forms): 624-dynamically add, edit, remove Form Controls durin… fix(dynamic-forms): dynamically add, edit, remove Form Controls Aug 9, 2017
@emoralesb05 emoralesb05 added this to the Beta.7 milestone Aug 9, 2017
@kyleledbetter

Copy link
Copy Markdown
Contributor

Pushed docs demo update:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TD-Dynamic-Forms: ERROR Error: Cannot find control with name: 'el04'

3 participants