npm.io
22.0.0 • Published 4 months ago

nxt-sortablejs

Licence
MIT
Version
22.0.0
Deps
1
Size
35 kB
Vulns
0
Weekly
0
Stars
26

Angular Sortablejs directive

GitHub license npm scope

This package provides Angular binding for Storablejs which works with standard arrays as well as Angular FormArray objects.

Installing

npm install --save nxt-sortablejs sortablejs
Import Sortablejs directive
import { SortablejsDirective } from 'nxt-sortablejs'

@Component({
    ...
    imports: [
        ...
        SortablejsDirective
    ]
})

If you want to cofigure global Sortablejs options, include provideGlobalSortableOptions in your application.

import { ApplicationConfig } from '@angular/core'
import { provideGlobalSortableOptions } from 'nxt-sortablejs'

export const appConfig: ApplicationConfig = {
    providers: [
        provideGlobalSortableOptions({
            animation: 150
        })
    ]
}
Use it in a template
<ul [nxtSortablejs]="items">
    <li *ngFor="let item of items">{{ item }}</li>
</ul>

Keywords