diff --git a/frontend/app/scripts/components/common/custom-field-input.component.js b/frontend/app/scripts/components/common/custom-field-input.component.js index f9deba706d..98353a5fd9 100644 --- a/frontend/app/scripts/components/common/custom-field-input.component.js +++ b/frontend/app/scripts/components/common/custom-field-input.component.js @@ -10,9 +10,9 @@ value: newValue }); }; - this.removeCustomField = function(fieldId) { + this.removeCustomField = function(id) { this.onRemove({ - fieldId: fieldId + fieldId: id }) } }, @@ -22,6 +22,7 @@ index: '<', field: '<', value: '=', + id: '<', onUpdate: '&', onRemove: '&', editable: '<', diff --git a/frontend/app/scripts/controllers/case/CaseDetailsCtrl.js b/frontend/app/scripts/controllers/case/CaseDetailsCtrl.js index 70cbb27cab..b07cc8aaef 100644 --- a/frontend/app/scripts/controllers/case/CaseDetailsCtrl.js +++ b/frontend/app/scripts/controllers/case/CaseDetailsCtrl.js @@ -111,6 +111,15 @@ .then(function () { return CaseSrv.removeCustomField(fieldId); }) + .then(function() { + var newList = _.reject($scope.caze.customFields, function(item) { + return item._id === fieldId + }); + + $scope.caze.customFields = newList; + + $scope.updateCustomFieldsList(); + }) .catch(function(err) { if(err && !_.isString(err)) { NotificationSrv.error('Remove custom field', err.data, err.status); diff --git a/frontend/app/views/components/common/custom-field-input.component.html b/frontend/app/views/components/common/custom-field-input.component.html index 35534b998d..e241299c69 100644 --- a/frontend/app/views/components/common/custom-field-input.component.html +++ b/frontend/app/views/components/common/custom-field-input.component.html @@ -1,7 +1,7 @@