-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sortable): add support for custom item templates (#1580)
refs #1554
- Loading branch information
Showing
6 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
demo/src/app/components/sortable/demos/custom-item-template/custom-item-template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template #itemTemplate let-item="item" let-index="index"><span>{{index}}: {{item.value}}</span></template> | ||
|
||
<div class="col-xs-6 col-md-3"> | ||
<bs-sortable | ||
[(ngModel)]="itemStringsLeft" | ||
[itemTemplate]="itemTemplate" | ||
itemClass="sortable-item" | ||
itemActiveClass="sortable-item-active" | ||
placeholderItem="Drag here" | ||
placeholderClass="placeholderStyle" | ||
wrapperClass="sortable-wrapper" | ||
></bs-sortable> | ||
<pre>model: {{ itemStringsLeft | json }}</pre> | ||
</div> | ||
<div class="col-xs-6 col-md-3"> | ||
<bs-sortable | ||
[(ngModel)]="itemStringsRight" | ||
itemClass="sortable-item" | ||
itemActiveClass="sortable-item-active" | ||
placeholderItem="Drag here" | ||
placeholderClass="sortable-item" | ||
wrapperClass="sortable-wrapper" | ||
></bs-sortable> | ||
<pre>model: {{ itemStringsRight | json }}</pre> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
demo/src/app/components/sortable/demos/custom-item-template/custom-item-template.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'custom-item-template-demo', | ||
templateUrl: './custom-item-template.html' | ||
}) | ||
export class CustomItemTemplateDemoComponent { | ||
public itemStringsLeft: any[] = [ | ||
'Windstorm', | ||
'Bombasto', | ||
'Magneta', | ||
'Tornado' | ||
]; | ||
|
||
public itemStringsRight: any[] = [ | ||
'Mr. O', | ||
'Tomato' | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters