Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't update list on change to select-items #2

Open
tellingson opened this issue Jan 16, 2016 · 6 comments
Open

Doesn't update list on change to select-items #2

tellingson opened this issue Jan 16, 2016 · 6 comments

Comments

@tellingson
Copy link

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 += ' ';
              }
          });
      });
  }
@tellingson
Copy link
Author

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.

@nch3ng
Copy link
Owner

nch3ng commented Jan 20, 2016

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
#2 (comment).

@designnotdrum
Copy link

@tellingson would be nice to see how you resolved this issue, can you submit a PR?

@tidjean
Copy link

tidjean commented Jan 16, 2017

Hello, It will be super cool to have the list dynamic. In my case I load the list from an api http request.

@mbelghazi
Copy link

Hello,
is there anyway to retrieve chipInput keyword used for search.
would really appreciate your help.
Regards

@ratatatKE
Copy link

ratatatKE commented Jul 17, 2017

@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
            });

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

No branches or pull requests

6 participants