Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.

Commit 61cdecb

Browse files
author
pkempenaers
committed
Merge branch 'develop'
# Conflicts: # docs/scripts/app.js
2 parents b8c3929 + f498725 commit 61cdecb

File tree

5 files changed

+67
-7
lines changed

5 files changed

+67
-7
lines changed

src/app/component/angularjs-dropdown-multiselect.directive.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default function dropdownMultiselectDirective() {
1212
translationTexts: '=',
1313
disabled: '=',
1414
},
15+
transclude: true,
1516
controller,
1617
templateUrl: 'app/component/angularjs-dropdown-multiselect.html',
1718
};

src/app/component/angularjs-dropdown-multiselect.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<div class="multiselect-parent btn-group dropdown-multiselect"
22
ng-class="{open: open}">
3-
<button ng-disabled="disabled"
4-
type="button"
5-
class="dropdown-toggle"
6-
ng-class="settings.buttonClasses"
7-
ng-click="toggleDropdown()">
8-
{{getButtonText()}}&nbsp;<span class="caret"></span>
9-
</button>
3+
<ng-transclude ng-click="toggleDropdown()">
4+
<button ng-disabled="disabled"
5+
type="button"
6+
class="dropdown-toggle"
7+
ng-class="settings.buttonClasses"
8+
>
9+
{{getButtonText()}}&nbsp;<span class="caret"></span>
10+
</button>
11+
</ng-transclude>
1012
<ul class="dropdown-menu dropdown-menu-form"
1113
ng-if="open"
1214
ng-style="{display: open ? 'block' : 'none', height : settings.scrollable ? settings.scrollableHeight : 'auto', overflow: 'auto' }">

src/app/main/main.controller.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,5 +310,14 @@ export default class MainController {
310310
return option;
311311
},
312312
};
313+
314+
$scope.transclusionModel = [];
315+
$scope.transclusionData = [
316+
{ id: 1, label: 'David' },
317+
{ id: 2, label: 'Jhon' },
318+
{ id: 3, label: 'Danny' },
319+
];
320+
$scope.transclusionSettings = {
321+
};
313322
}
314323
}

src/app/main/main.template.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,47 @@ <h3>Code</h3>
973973
smartButtonTextConverter(skip, option) {
974974
return option;
975975
},
976+
};
977+
</div>
978+
</div>
979+
</div>
980+
</div>
981+
<div uib-accordion-group heading="Custom trigger element using transclusion">
982+
<div class="row">
983+
<div class="col-xs-12">
984+
Example to show that you can replace the button with a custom element
985+
</div>
986+
</div>
987+
<div class="row">
988+
<div class="col-xs-12 col-sm-6">
989+
<h3>Demo</h3>
990+
<div class="well">
991+
<div ng-dropdown-multiselect="" options="transclusionData" selected-model="transclusionModel" extra-settings="transclusionSettings">
992+
<span class="custom-trigger">My Custom trigger</span>
993+
</div>
994+
</div>
995+
</div>
996+
<div class="col-xs-12 col-sm-6">
997+
<h3>The model:</h3>
998+
<pre>{{transclusionModel|json}}</pre>
999+
</div>
1000+
</div>
1001+
<div class="row">
1002+
<div class="col-md-12">
1003+
<h3>Code</h3>
1004+
<div hljs language="javascript">
1005+
// HTML
1006+
<div ng-dropdown-multiselect="" options="transclusionData" selected-model="transclusionModel" extra-settings="transclusionSettings">
1007+
<span class="custom-trigger">My Custom trigger</span>
1008+
</div>
1009+
1010+
$scope.transclusionModel = [];
1011+
$scope.transclusionData = [
1012+
{ id: 1, label: 'David' },
1013+
{ id: 2, label: 'Jhon' },
1014+
{ id: 3, label: 'Danny' },
1015+
];
1016+
$scope.transclusionSettings = {
9761017
};
9771018
</div>
9781019
</div>

src/app/main/stylesheet.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,13 @@ footer a:hover {
395395
opacity: 0.5;
396396
}
397397
}
398+
399+
.custom-trigger {
400+
padding: 0.75em;
401+
margin-top: 1.5em;
402+
border: 1px solid #ccc;
403+
cursor: pointer;
404+
}
398405
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
399406
@media only screen and (min-width: 480px) and (max-width: 767px) {
400407
}

0 commit comments

Comments
 (0)