md-chips-select
md-chips-select copied to clipboard
Doesn't update list on change to select-items
This only works with a static list because you do the select-items parsing on load. The parse needs to happen any time the select-items list changes. For example, pulling the list of items in an http request. I solved it setting up a watch on selectItems and parsing it any time that it changes.
scope.$watch('selectItems', function (newValue, oldValue) {
if (newValue === oldValue) {
return;
}
scope.mdSelectItems = newValue;
parseSelectedItems();
})
function parseSelectedItems() {
angular.forEach(scope.mdSelectItems, function (obj, key) {
obj.mainTitle = '';
angular.forEach(subString, function (field, fkey) {
if (obj[field] != null) {
obj.mainTitle += obj[field].toString();
obj.mainTitle += ' ';
}
});
});
}
Actually, I ended up having to make quite a few more changes to get this to work properly. If you would like me to post my code/submit a pull request let me know. Otherwise, I will leave it in your capable hands to fix as you see fit.
It's great yo use your code!
On Sat, Jan 16, 2016 at 8:54 AM, tellingson [email protected] wrote:
Actually, I ended up having to make quite a few more changes to get this to work properly. If you would like me to post my code/submit a pull request let me know. Otherwise, I will leave it in you capable hands to fix as you see fit.
— Reply to this email directly or view it on GitHub https://github.com/qqnc/md-chips-select/issues/2#issuecomment-172226726.
@tellingson would be nice to see how you resolved this issue, can you submit a PR?
Hello, It will be super cool to have the list dynamic. In my case I load the list from an api http request.
Hello, is there anyway to retrieve chipInput keyword used for search. would really appreciate your help. Regards
@qqnc @tellingson Still stuck with this, doesn't update when you need to use a dynamic list from http through a service like so
$scope.sItems = [];
obtainSamthingFromServer.getThenceFromServer(false)
.then(function (response) {
$scope.sItems = response;
console.log($scope.sItems); //Shows my dynamic object but does not update the dropdown in ui
});