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.
.directive('crmUiSelect', function ($parse, $timeout) {
return {
require: '?ngModel',
+ priority: 1,
scope: {
crmUiSelect: '='
},
element.crmSelect2(scope.crmUiSelect || {});
if (ngModel) {
element.on('change', refreshModel);
- $timeout(ngModel.$render);
}
}