var ts = $scope.ts = CRM.ts('org.civicrm.search_kit'),
ctrl = this;
- this.$onInit = function() {
+ this.getWidget = function() {
if (!ctrl.param || !ctrl.param[ctrl.flag]) {
- this.widget = null;
+ return null;
} else if (_.keys(ctrl.param[ctrl.flag]).length === 2 && '' in ctrl.param[ctrl.flag]) {
- this.widget = 'checkbox';
+ return 'checkbox';
} else {
- this.widget = 'select';
+ return 'select';
}
};
}
-<span ng-switch="$ctrl.widget">
+<span ng-switch="$ctrl.getWidget()">
<span ng-switch-when="checkbox">
<label ng-repeat="(val, label) in $ctrl.param[$ctrl.flag]" ng-if="val">
<input type="checkbox" ng-checked="$ctrl.arg[$ctrl.flag] === val" ng-click="$ctrl.arg[$ctrl.flag] = ($ctrl.arg[$ctrl.flag] === val ? null : val); $ctrl.writeExpr();" >