From ec73673dc0fb05832e900d2b7041fa64df571b04 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 8 Apr 2023 12:45:08 -0400 Subject: [PATCH] Afform - support field defaults from the url even when in a popup When in the context of a poup dialog the routeParams are not passed in from the url and must be accessed through $scope. --- ext/afform/core/ang/af/afField.component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/afform/core/ang/af/afField.component.js b/ext/afform/core/ang/af/afField.component.js index 66c49816a6..9e7ac0e0c8 100644 --- a/ext/afform/core/ang/af/afField.component.js +++ b/ext/afform/core/ang/af/afField.component.js @@ -12,7 +12,7 @@ fieldName: '@name', defn: '=' }, - controller: function($scope, $element, crmApi4, $timeout, $location) { + controller: function($scope, $element, crmApi4, $timeout) { var ts = $scope.ts = CRM.ts('org.civicrm.afform'), ctrl = this, // Prefix used for SearchKit explicit joins @@ -98,7 +98,7 @@ var entityName = ctrl.afFieldset.getName(), joinEntity = ctrl.afJoin ? ctrl.afJoin.entity : null, uniquePrefix = '', - urlArgs = $location.search(); + urlArgs = $scope.$parent.routeParams; if (entityName) { var index = ctrl.getEntityIndex(); uniquePrefix = entityName + (index ? index + 1 : '') + (joinEntity ? '.' + joinEntity : '') + '.'; -- 2.25.1