From: Coleman Watts Date: Sat, 3 Oct 2020 00:45:47 +0000 (-0400) Subject: Updates for Angular 1.8 - fix premature access to component properties X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=79868cc2a719aca1fea526b9e02a8bd492963e8f;p=civicrm-core.git Updates for Angular 1.8 - fix premature access to component properties Angular 1.8 doesn't seem to like it when you try to access component properties before the init function. --- diff --git a/ext/search/ang/search/crmSearchActions.component.js b/ext/search/ang/search/crmSearchActions.component.js index 6711ea135b..73ed61a092 100644 --- a/ext/search/ang/search/crmSearchActions.component.js +++ b/ext/search/ang/search/crmSearchActions.component.js @@ -12,10 +12,10 @@ templateUrl: '~/search/crmSearchActions.html', controller: function($scope, crmApi4, dialogService, searchMeta) { var ts = $scope.ts = CRM.ts(), - entityTitle = searchMeta.getEntity(this.entity).titlePlural, ctrl = this; - this.init = function() { + this.$onInit = function() { + var entityTitle = searchMeta.getEntity(ctrl.entity).titlePlural; if (!ctrl.actions) { var actions = _.transform(_.cloneDeep(CRM.vars.search.actions), function (actions, action) { if (_.includes(action.entities, ctrl.entity)) { diff --git a/ext/search/ang/search/crmSearchFunction.component.js b/ext/search/ang/search/crmSearchFunction.component.js index 9b7efce4b8..1b2c45832d 100644 --- a/ext/search/ang/search/crmSearchFunction.component.js +++ b/ext/search/ang/search/crmSearchFunction.component.js @@ -10,9 +10,9 @@ controller: function($scope, formatForSelect2, searchMeta) { var ts = $scope.ts = CRM.ts(), ctrl = this; - this.functions = formatForSelect2(_.where(CRM.vars.search.functions, {category: this.cat}), 'name', 'title'); this.$onInit = function() { + ctrl.functions = formatForSelect2(_.where(CRM.vars.search.functions, {category: ctrl.cat}), 'name', 'title'); var fieldInfo = searchMeta.parseExpr(ctrl.expr); ctrl.path = fieldInfo.path + fieldInfo.suffix; ctrl.field = fieldInfo.field;