X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ang%2FcrmUi.js;h=4ea687c32964e87a5d0dad35ac30c3bcb92e454f;hb=2c0f8c6797d810bc6a3202b7d0c18e762f5f22ec;hp=879b2a8c43f690622a069671d8743afc0adb6646;hpb=fa71b5e1ba9b789722b265b758d38c8ecd982bdd;p=civicrm-core.git diff --git a/ang/crmUi.js b/ang/crmUi.js index 879b2a8c43..4ea687c329 100644 --- a/ang/crmUi.js +++ b/ang/crmUi.js @@ -5,7 +5,7 @@ pageTitle = 'CiviCRM', documentTitle = 'CiviCRM'; - angular.module('crmUi', []) + angular.module('crmUi', CRM.angRequires('crmUi')) // example
...content...
// WISHLIST: crmCollapsed should support two-way/continuous binding @@ -588,7 +588,12 @@ $timeout(function () { // ex: msg_template_id adds new item then selects it; use $timeout to ensure that // new item is added before selection is made - element.select2('val', ngModel.$modelValue); + var newVal = _.cloneDeep(ngModel.$modelValue); + // Fix possible data-type mismatch + if (typeof newVal === 'string' && element.select2('container').hasClass('select2-container-multi')) { + newVal = newVal.length ? newVal.split(',') : []; + } + element.select2('val', newVal); }); }; } @@ -631,7 +636,12 @@ $timeout(function () { // ex: msg_template_id adds new item then selects it; use $timeout to ensure that // new item is added before selection is made - element.select2('val', ngModel.$modelValue); + var newVal = _.cloneDeep(ngModel.$modelValue); + // Fix possible data-type mismatch + if (typeof newVal === 'string' && element.select2('container').hasClass('select2-container-multi')) { + newVal = newVal.length ? newVal.split(',') : []; + } + element.select2('val', newVal); }); }; function refreshModel() { @@ -680,7 +690,8 @@ return { restrict: 'EA', scope: { - crmUiTabSet: '@' + crmUiTabSet: '@', + tabSetOptions: '@' }, templateUrl: '~/crmUi/tabset.html', transclude: true,