Hi I am using angular js to construct my application. I have one problem while generating dynamic form. My json is :
{
lines :[ {
fields:[{
fieldType : "input",
labelName : "Test Label",
modelName : "testInput"
},{
fieldType : "select",
labelName : "Test Label",
options : "['opt1','opt2','opt3']",
modelName : "testSelect"
},{
fieldType : "checkbox",
labelName : "Test Label",
modelName : "testCheckbox",
options : '[{'key':'key1','value':'value1'}]"
}]
}
This is just sample json. In real time, it is more complex type. I am created separate component for all the Html Elements like "input","select","checkbox","radio"... I am using Directives for all the input element. I am taking few details from parent scope of form to directive. for eg:
Main Directive
<ui-form form-option='uiFormOption'></ui-form>
Above is the main directive. i am passing above json in this Main Directive.
Inside the directive, i am iterating all the lines and and calling respective directive to fill the components based on field type.
Here, in the Html component directives are creating isolated scope i need that too fine.
When i save this from, i need to get all the data in single object in ParentScope something like $scope.myFormData = {}; //Parent Scope controller. when i click save, all the data must be collect. my problem is $scope in child directive. so model map not be aware to parent. How to achieve this...