AngularJS directive which takes JSON representing a form and renders to HTML
formlyConfig.setType({
name: 'phone',
extends: 'maskedInput',
defaultOptions: {
templateOptions: {
mask: '999-999?9-9999'
},
Error: [ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported. http://errors.angularjs.org/1.6.3/ng/cpws
in order to use angular-formly with angularjs 1.7.8 (it was a pentest requirement to use the latest version of angularjs) . What I did is to replace the function reverseDeepMerge(dest)
. So far it seems to have solved it. function reverseDeepMerge(dest) {
_angularFix2['default'].forEach(arguments, function (src, index) {
if (!index) {
return;
}
_angularFix2['default'].forEach(src, function (val, prop) {
if (!_angularFix2['default'].isDefined(dest[prop])) {
//dest[prop] = _angularFix2['default'].copy(val);
if(typeof val === 'object' && val!==null){
dest[prop] = Object.assign(Object.create(val.__proto__),val);
}else{
dest[prop] = val;
}
} else if (objAndSameType(dest[prop], val)) {
reverseDeepMerge(dest[prop], val);
}
});
});
return dest;
}
FormlyFieldConfig
type, with a fieldGroup
field {key: "myfile", type: "file"}
however if I log my form model I can't see a myfile
key within returned json. What's wrong with my code??