Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

multiCheckbox does not populate values when checkbox values are async #32

Closed
m0t0r opened this issue Jun 25, 2015 · 3 comments
Closed

Comments

@m0t0r
Copy link
Contributor

m0t0r commented Jun 25, 2015

Working with multiCheckbox I found an issue. As demonstrated in this jsbin. In the first case, I predefine checkbox values in options array, and then I simulate async population of the values and in the UI we can see checked checkbox. In the second case I simulate async loading of the checkbox values and when I populate values, the checkbox is not checked.

@ckniffen
Copy link
Member

@m0t0r I think this is a problem. It is because of the funky things that have to be done to get multicheckboxes to work in angular. The code is not watching the model value for external changes.

The code in questions is here

const modelValue = $scope.model[opts.key];
if (angular.isArray(modelValue)) {
const valueProp = to.valueProp || 'value';
angular.forEach(to.options, function(v, index) {
$scope.multiCheckbox.checked[index] = modelValue.indexOf(v[valueProp]) !== -1;
});
}
.

@m0t0r
Copy link
Contributor Author

m0t0r commented Jun 26, 2015

@ckniffen, I see. Any chance to get this fixed ? It is blocking me in the project.

@kentcdodds
Copy link
Member

@m0t0r, you may have to write your own version. I definitely don't have time to implement this new feature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants