Commit 93a007ce authored by totten's avatar totten
Browse files

CRM-20871 - crmUiSelect - UI should stay in sync with model

The `crmUiSelect` defines the function `$render()` -- whenever the model
changes, it should update execute `$render()` to update the UI.  But it doesn't.

This issue is discussed more in https://stackoverflow.com/questions/21084088/why-ngmodels-render-is-not-called-when-the-model-changes-in-angularjs

== Before ==

The `$render()` function for directive `crm-ui-select` is not called because the `select`
directive overrides it.

== After ==

The `$render()` function for directive `crm-ui-select` is called, even if
used on a `select` element.

== Acceptance Criteria ==

 * The test page in https://github.com/totten/org.example.angpage (`civicrm/a/#/play`)
   keeps elements synchronized.
 * Existing screens which use `crm-ui-select` continue to work.
parent 8e998f78
......@@ -576,6 +576,7 @@
.directive('crmUiSelect', function ($parse, $timeout) {
return {
require: '?ngModel',
priority: 1,
scope: {
crmUiSelect: '='
},
......@@ -611,7 +612,6 @@
element.crmSelect2(scope.crmUiSelect || {});
if (ngModel) {
element.on('change', refreshModel);
$timeout(ngModel.$render);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment