From 7b5b88a8306afa67ff098175cb7f5d6bca26390e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 23 Dec 2021 10:07:26 -0500 Subject: [PATCH] Afform - refactor add value to use new onCrmUiSelect directive --- .../ang/afGuiEditor/afGuiEntity.component.js | 19 +++++++++---------- .../admin/ang/afGuiEditor/afGuiEntity.html | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js b/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js index de487e19a7..001a580b46 100644 --- a/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js +++ b/ext/afform/admin/ang/afGuiEditor/afGuiEntity.component.js @@ -194,6 +194,15 @@ return found.match; } + this.addValue = function(fieldName) { + if (fieldName) { + if (!ctrl.entity.data) { + ctrl.entity.data = {}; + } + ctrl.entity.data[fieldName] = ''; + } + }; + this.$onInit = function() { // When a new block is saved, update the list this.meta = afGui.meta; @@ -201,16 +210,6 @@ $scope.controls.fieldSearch = ''; ctrl.buildPaletteLists(); }); - - $scope.$watch('controls.addValue', function(fieldName) { - if (fieldName) { - if (!ctrl.entity.data) { - ctrl.entity.data = {}; - } - ctrl.entity.data[fieldName] = ''; - $scope.controls.addValue = ''; - } - }); }; } }); diff --git a/ext/afform/admin/ang/afGuiEditor/afGuiEntity.html b/ext/afform/admin/ang/afGuiEditor/afGuiEntity.html index a92c376322..712e648dfb 100644 --- a/ext/afform/admin/ang/afGuiEditor/afGuiEntity.html +++ b/ext/afform/admin/ang/afGuiEditor/afGuiEntity.html @@ -10,7 +10,7 @@
- +
-- 2.25.1