angularjs - Re-initialize angular form with dynamically generated input fields -


i have form dropdown. depending on value of dropdown compile custom directive form. directive contains form inputs. when change dropdown value, compiled directive gets removed , new compiled directive added. far works fine. have form validation whole form. problem when "switch directive" validates input fields of old directive. because $scope.form (my form) keeping field tough not on view anymore.

my question, there way re-initialize form on scope form inputs shown on view in angular form?

print of $scope form

the red 1 no longer on form still in form object.

i prefer using ng-include. make select items like

[{caption: 'foo', templateurl: '/foo.html'}, {caption: 'bar', templateurl: '/bar.html'}] 

where templateurl points desired partial view inputs. bind selected item's template url ng-include. keep required partial on page , remove old inputs , won't have problems validation.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -