fixed new user model input and renaming model group

This commit is contained in:
VLE2FE
2020-09-01 13:55:13 +02:00
parent 8fd993b362
commit ea02ba0f09
6 changed files with 26 additions and 10 deletions

View File

@ -122,16 +122,22 @@ export class RbArrayInputComponent implements ControlValueAccessor, OnInit, Afte
this.values = [this.values[0]];
res = this.values;
}
if (!res.length) {
res = [''];
}
// if (!res.length) {
// res = [''];
// }
this.onChange(res); // trigger ngModel with filled elements
}
writeValue(obj: any) { // add empty value on init
console.log(obj);
if (obj) {
if (this.pushTemplate !== null) {
this.values = [...obj.filter(e => e[this.pushPath] !== ''), cloneDeep(this.pushTemplate)];
if (this.pushPath) {
this.values = [...obj.filter(e => e[this.pushPath] !== ''), cloneDeep(this.pushTemplate)];
}
else {
this.values = [...obj.filter(e => e !== ''), cloneDeep(this.pushTemplate)];
}
}
else {
this.values = obj;