angular-multi-select
angular-multi-select copied to clipboard
Format button label with CSS
I think it is a good idea to remove commas and nbsp; manipulations from js:
js:
$scope.refreshButton = function() {
...
if ( ctr < tempMaxLabels ) {
- $scope.varButtonLabel += ( $scope.varButtonLabel.length > 0 ? '</div>, <div class="buttonLabel">' : '<div class="buttonLabel">') + $scope.writeLabel( value, 'buttonLabel' );
+ $scope.varButtonLabel += '<div class="buttonLabel">' + $scope.writeLabel( value, 'buttonLabel' ) + '</div>';
}
...
$scope.writeLabel = function( item, type ) {
...
angular.forEach( temp, function( value, key ) {
- item[ value ] && ( label += ' ' + value.split( '.' ).reduce( function( prev, current ) {
+ item[ value ] && ( label += value.split( '.' ).reduce( function( prev, current ) {
return prev[ current ];
css:
/* labels on the button */
.multiSelect .buttonLabel {
display: inline-block;
padding: 5px 0px 5px 0px;
}
+.multiSelect .buttonLabel + .buttonLabel:before {
+ content: ',\2009'; //  
+}
/* item labels */
.multiSelect .multiSelectItem {
display: block;
- padding: 3px;
+ padding: 3px 3px 3px 8px;
Thanks.