angular-form-builder
angular-form-builder copied to clipboard
Form elements ng-model dual binding
I have saved the form ng-model and if i want to edit the form again, all fields are empty, but $scope.input has the data.
Please help. Dinesh
@dinesh52 Did u fix that?? Even i wanted to show the saved the form.. Could u pls help.
$scope.defaultValue = {}; if (val.label == v.label) { val['value'] = v.value; $builder.addFormObject('default', val); if (val.hasOwnProperty('value')) { $scope.defaultValue[val.id] = val.value; } } else { $builder.addFormObject('default', val); }
I made this working in this way, val is coming from angularforloop of varaible which has form data
Thank you very much @dinesh52
In my case, when i drag-and-drop elements, theid is null
(nothing defined) in element object.
http://kelp404.github.io/angular-form-builder/
- Drag and Drop Textbox
- Check the Scope //the element will not have any id //how will we populate the default value?
For that reason only we are assigning id val in defaultvalue to replace it $scope.defaultValue[val.id] = val.value;
ensure that when using $builder.insertFormObject(... you also generate the "id", e.g.:
...
$builder.insertFormObject(scope.formName, $(element).find('.empty').index('.fb-form-object-editable'), {
id: Math.random().toString(36).slice(2),
component: draggable.object.componentName
});
...