Skip to content

Commit

Permalink
Updates for Angular 1.8 - fix premature access to component properties
Browse files Browse the repository at this point in the history
Angular 1.8 doesn't seem to like it when you try to access component properties
before the init function.
  • Loading branch information
colemanw committed Oct 3, 2020
1 parent 4f3a95d commit 7a56c06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/search/ang/search/crmSearchActions.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
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)) {
Expand Down
2 changes: 1 addition & 1 deletion ext/search/ang/search/crmSearchFunction.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7a56c06

Please sign in to comment.