27
27
showSearch : '=?' ,
28
28
searchFilter : '=?' ,
29
29
disabled : '=?ngDisabled' ,
30
- defaultText : '@ '
30
+ labels : '=? '
31
31
} ,
32
32
require : 'ngModel' ,
33
33
templateUrl : 'multiselect.html' ,
34
34
link : function ( $scope , $element , $attrs , $ngModelCtrl ) {
35
35
$scope . selectionLimit = $scope . selectionLimit || 0 ;
36
36
$scope . searchLimit = $scope . searchLimit || 25 ;
37
- $scope . defaultText = $scope . defaultText || 'Select' ;
38
37
39
38
$scope . searchFilter = '' ;
40
39
116
115
return $scope . getDisplay ( $scope . selectedOptions [ 0 ] ) ;
117
116
}
118
117
if ( $scope . selectedOptions && $scope . selectedOptions . length > 1 ) {
119
- var totalSelected ;
120
- totalSelected = angular . isDefined ( $scope . selectedOptions ) ? $scope . selectedOptions . length : 0 ;
118
+ var totalSelected = angular . isDefined ( $scope . selectedOptions ) ? $scope . selectedOptions . length : 0 ;
121
119
if ( totalSelected === 0 ) {
122
- return $scope . defaultText ;
120
+ return $scope . labels && $scope . labels . select ? $scope . labels . select : 'Select' ;
123
121
} else {
124
- return totalSelected + ' ' + 'selected' ;
122
+ return totalSelected + ' ' + ( $scope . labels && $scope . labels . itemsSelected ? $scope . labels . itemsSelected : 'selected' ) ;
125
123
}
126
124
} else {
127
- return $scope . defaultText ;
125
+ return $scope . labels && $scope . labels . select ? $scope . labels . select : 'Select' ;
128
126
}
129
127
} ;
130
128
@@ -246,12 +244,12 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
246
244
"\n" +
247
245
" <li ng-show=\"showSelectAll\">\n" +
248
246
" <a ng-click=\"selectAll()\" href=\"\">\n" +
249
- " <span class=\"glyphicon glyphicon-ok\"></span> Select All\n" +
247
+ " <span class=\"glyphicon glyphicon-ok\"></span> {{labels.selectAll || ' Select All'}} \n" +
250
248
" </a>\n" +
251
249
" </li>\n" +
252
250
" <li ng-show=\"showUnselectAll\">\n" +
253
251
" <a ng-click=\"unselectAll()\" href=\"\">\n" +
254
- " <span class=\"glyphicon glyphicon-remove\"></span> Unselect All\n" +
252
+ " <span class=\"glyphicon glyphicon-remove\"></span> {{labels.unselectAll || ' Unselect All'}} \n" +
255
253
" </a>\n" +
256
254
" </li>\n" +
257
255
" <li ng-show=\"(showSelectAll || showUnselectAll)\"\n" +
@@ -269,7 +267,7 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
269
267
" <li ng-show=\"showSearch\">\n" +
270
268
" <div class=\"dropdown-header\">\n" +
271
269
" <input type=\"text\" class=\"form-control input-sm\" style=\"width: 100%;\"\n" +
272
- " ng-model=\"searchFilter\" placeholder=\"Search...\" ng-change=\"updateOptions()\"/>\n" +
270
+ " ng-model=\"searchFilter\" placeholder=\"{{labels.search || ' Search...'}} \" ng-change=\"updateOptions()\"/>\n" +
273
271
" </div>\n" +
274
272
" </li>\n" +
275
273
"\n" +
@@ -284,7 +282,7 @@ angular.module("multiselect.html", []).run(["$templateCache", function($template
284
282
"\n" +
285
283
" <li class=\"divider\" ng-show=\"selectionLimit > 1\"></li>\n" +
286
284
" <li role=\"presentation\" ng-show=\"selectionLimit > 1\">\n" +
287
- " <a>{{selectedOptions.length || 0}} / {{selectionLimit}} selected</a>\n" +
285
+ " <a>{{selectedOptions.length || 0}} / {{selectionLimit}} {{labels.itemsSelected || ' selected'}} </a>\n" +
288
286
" </li>\n" +
289
287
"\n" +
290
288
" </ul>\n" +
0 commit comments