indrimuska / angular-selector

A native AngularJS directive that transform a simple <select> box into a full html select with typeahead.
http://indrimuska.github.io/angular-selector
MIT License
96 stars 36 forks source link

Cannot read property 'then' of undefined #71

Closed matt212 closed 7 years ago

matt212 commented 7 years ago

Hi ,

Again awesome multiselect plugin . i am want to pass dynamic return type for multiple (multiselects) and hence assign value through global scope base.multiselectname and base.multiselectID and I am getting this error isues

My code base

`var options = {
            url: '',
            method: 'GET',
            cache: true,
            headers: base.config.headers,
            transformResponse: function(data) {

                var result = angular.fromJson(data);
console.log(result);
                return result.map(function(country) {
                    return {
                        Mname: country[base.multiselectname],
                        modnameID: country[base.multiselectID]
                    };
                });

            }
        };

        //$scope.country = 'SV';

        base.colsearch = "Rolename";
        base.multiselectID="RoleID";
        base.multiselectname="Rolename";
        $scope.remote = angular.copy(options);

        $scope.remote.url = '/role/api/searchtype/' + base.pageno + '/' + base.pageSize + '/' + base.searchparam + '/' + base.colsearch + '', base.config;

        $scope.remoteParam = "modname";`     

and html part of code

`<script type="text/ng-template" id="selector/demo/country">
      <i class="flag" ng-class="option.modnameID.toLowerCase()"></i>&nbsp;
      [{option.Mname}]
    </script>
  <select selector
      model="Mname"
      value-attr="modnameID"
      remote="remote"
      remote-param="[{remoteParam}]"
      view-item-template="'selector/demo/country'"
      dropdown-item-template="'selector/demo/country'"
      placeholder="Choose one or more countries..."
      change="assigncall(newValue, oldValue)"
      multi="true"
      ></select>`
matt212 commented 7 years ago

the issue was remote="remote2" tag in my second instance of multiselect