1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Use ng select for multiselect

This commit is contained in:
Chocobozzz 2020-08-11 16:07:53 +02:00
parent 3d25d5de33
commit 52c4976fcf
No known key found for this signature in database
GPG key ID: 583A612D890159BE
31 changed files with 316 additions and 198 deletions

View file

@ -0,0 +1,41 @@
<ng-select
[items]="availableItems"
[(ngModel)]="selectedItems"
(ngModelChange)="onModelChange()"
i18n-placeholder placeholder="Add a new language"
[clearable]="true"
[multiple]="true"
[searchable]="true"
[closeOnSelect]="false"
bindValue="id"
bindLabel="label"
notFoundText="No items found" i18n-notFoundText
[selectableGroup]="selectableGroup"
[selectableGroupAsModel]="selectableGroupAsModel"
groupBy="group"
[compareWith]="compareFn"
[maxSelectedItems]="maxSelectedItems"
>
<ng-template ng-optgroup-tmp let-item="item" let-item$="item$" let-index="index">
<div class="form-group-checkbox">
<input id="item-{{index}}" type="checkbox" [ngModel]="item$.selected"/>
<span role="checkbox" [attr.aria-checked]="item$.selected"></span>
<span>{{ item.group }}</span>
</div>
</ng-template>
<ng-template ng-option-tmp let-item="item" let-item$="item$" let-index="index">
<div class="form-group-checkbox">
<input id="item-{{index}}" type="checkbox" [ngModel]="item$.selected"/>
<span role="checkbox" [attr.aria-checked]="item$.selected"></span>
<span>{{ item.label }}</span>
</div>
</ng-template>
</ng-select>