1

I am using angularjs-selector.js(https://github.com/ssotomayor/angular-selector) for multi-select functionality My case scenario applies with Remote fetching with custom service mode of this plugin reference url:- http://plnkr.co/edit/YdzF58o9ykYvMwP5Udza?p=preview

angular
    .module('myApp', ['selector'])
    .service('$countries', ['$q','$http', function ($q, $http) {
        function Countries() {}
        Countries.prototype.search = function (search) {

          var def = $q.defer();
          if(search){

            var settings = {
                url: 'http://services.groupkt.com/country/search',
                method: 'GET',
                cache: true,
                params: {
                    text: search
                },
                transformResponse: function (data) {
                    var countries = angular.fromJson(data).RestResponse.result;
                    return countries.map(function (country) {
                        return {
                            name: country.name,
                            code: country.alpha2_code
                        };
                    });
                }
            };
            return $http(settings);

        }
        else{
          def.resolve([])
        }

        return def.promise;
        };
        return new Countries();
    }])
    .controller('ExampleCtrl', ['$scope', '$countries', function ($scope, $countries) {

        $scope.countries = [ "BR" ];
        $scope.remote = function (search) {
            return $countries.search(search);
        };
    }]);

now everthing works as expected ,

in my scenario i use grid with edit functionality with ngdialog box while editing i wanted to assign those values back to multiselect which is not happening

However, there is feature to add user inputs to multiselect , i was thinking one can reuse the functionality and can be effective applied for edit purpose.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.