Skip to content

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

@tellingson

Description

@tellingson

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 += ' ';
              }
          });
      });
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions