I've only looked at this briefly, and I was hoping it's just something I'm overlooking. Any data that is queried asynchronously doesn't seem to update the selected item in a dropdown until the next digest loop.
Here's some code to add to src/dropdown/examples.html:
This seems counter-intuitive. A good use case for this would be a country dropdown where countries are retrieved from an API and on success, the current user's country is selected from the array.
I'm thinking there's a $scope.$eval that's missing in sm-dropdown when applying the model, but I don't see it since applyValues is being called:
On element.ready
On model change
On items change
And these seem to conflict with the modelWatcher's intentions of set/update on the model (where $scope.$eval does exist and allows core to ignore updates on the model once for the digest).
I've only looked at this briefly, and I was hoping it's just something I'm overlooking. Any data that is queried asynchronously doesn't seem to update the selected item in a dropdown until the next digest loop.
Here's some code to add to
src/dropdown/examples.html
:This code does not result in a selected item defined by
model8
as I would expect:This code works because
model8
is applied in a separate digest.This seems counter-intuitive. A good use case for this would be a country dropdown where countries are retrieved from an API and on success, the current user's country is selected from the array.
I'm thinking there's a $scope.$eval that's missing in sm-dropdown when applying the model, but I don't see it since
applyValues
is being called:And these seem to conflict with the
modelWatcher
's intentions of set/update on the model (where $scope.$eval does exist and allows core to ignore updates on the model once for the digest).Any pointers or suggestions?