Adding two attrs dynamically map Method
by Vatsal Pande
JavaScript
(function(){
var compactForm = [
{
key: "Address",
},
{
key: "BuilderName",
},
{
key: "CoListOfficeName",
ngModelOptions: { updateOn: 'blur' }
},
{
key: "BathsFull",
onChange: "appraise.updated(modelValue,form)",
ngModelOptions: { updateOn: 'blur' }
}];
function convertForm(formObj){
var convertedForm = formObj.map(function(item){
if(!item.onChange){
item.onchange = "appraise.updated(modelValue,form)";
}
if(!item.ngModelOptions){
item.ngModelOptions= {};
item.ngModelOptions.updateOn = 'blur';
}
return item;
});
console.info(formObj);
console.info(convertedForm);
}
convertForm(compactForm);
})();