1

I have this plunker that has an example of angularjs dropdown multiselect , my problem is when selection limit is 1 and has a selectd model when I click to any other item in the list is doesn't change the selection until uncheck the previous one, any one have an experience in angularjs can solve the problem which is prevent select item until unselect the previous item?

    var myApp = angular.module("myApp", ['angularjs-dropdown-multiselect']);

myApp.controller("MyController", ["$scope", function($scope) {
  $scope.message = "Angularjs-multiselect-dropdown";
  $scope.example6model = [{id: 1}, {id: 3}]; 
  $scope.example6data = [{id: 1, label: "David"}, {id: 2, label: "Jhon"}, {id: 3, label: "Danny"}]; 
  $scope.example6settings = {};

  $scope.example65model = [{id: 1}]; 
  $scope.example65data = [{id: 1, label: "David"}, {id: 2, label: "Jhon"}, {id: 3, label: "Danny"}]; 
  $scope.example65settings = {selectionLimit: 1};
}]);

1 Answer 1

1

You should use a single object as model and not an array when you have single selection functionality enabled.

Such as:

$scope.example65model = {id: 1};

You can see an example in the documentation in "Single Selection Limit" area.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you very much ,working 100%. you saved 2 weeks of my working

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.