Lwm2m: front fix bug: config profile -> add object if list empty
This commit is contained in:
parent
d2469420ad
commit
9c3bf2063b
@ -134,7 +134,7 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
|
||||
}
|
||||
|
||||
private add(object: ObjectLwM2M): void {
|
||||
if (this.modelValue.indexOf(object.id) === -1) {
|
||||
if (isDefinedAndNotNull(this.modelValue) && this.modelValue.indexOf(object.id) === -1) {
|
||||
this.modelValue.push(object.id);
|
||||
this.objectsList.push(object);
|
||||
this.lwm2mListFormGroup.get('objectsList').setValue(this.objectsList);
|
||||
@ -151,9 +151,6 @@ export class Lwm2mObjectListComponent implements ControlValueAccessor, OnInit, V
|
||||
index = this.modelValue.indexOf(object.id);
|
||||
this.modelValue.splice(index, 1);
|
||||
this.removeList.next(object);
|
||||
if (!this.modelValue.length) {
|
||||
this.modelValue = null;
|
||||
}
|
||||
this.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user