Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
fixed #3
Browse files Browse the repository at this point in the history
  • Loading branch information
amitava82 committed Aug 15, 2013
1 parent 2e96b85 commit 0500a40
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ angular.module('ui.multiselect', [])
element.append($compile(popUpEl)(scope));

function getHeaderText() {
if (!modelCtrl.$modelValue || !modelCtrl.$modelValue.length) return scope.header = 'Select';
if (is_empty(modelCtrl.$modelValue)) return scope.header = 'Select';

if (isMultiple) {
scope.header = modelCtrl.$modelValue.length + ' ' + 'selected';
} else {
Expand All @@ -126,6 +127,13 @@ angular.module('ui.multiselect', [])
scope.header = parsedResult.viewMapper(local);
}
}

function is_empty(obj) {
if (!obj) return true;
if (obj.length && obj.length > 0) return false;
for (var prop in obj) if (obj[prop]) return false;
return true;
};

scope.valid = function validModel() {
if(!required) return true;
Expand Down Expand Up @@ -255,4 +263,4 @@ angular.module('ui.multiselect', [])
}
}
}
}]);
}]);

0 comments on commit 0500a40

Please sign in to comment.