| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Fully declarative (multi)sortable for AngularJS
Demo: http://kamilkp.github.io/angular-sortable-view/
You can find the source code for this demo on branch "gh-pages".
Also see the changelog here
###DESCRIPTION:
This is a simple library written as a module for AngularJS for sorting elements in the UI. It supports both single elements list, and multiple connected lists, where an element can be moved from one to another.
This library requires no dependencies whatsoever (except angular.js of course), so you no longer need to include jQuery and jQueryUI and angularUI which altogether gives the size of around 340kB minified. Whereas the angular-sortable-view is only 5kB minified!.
###API:
The API is declarative. There are four directives (hooked on attributes) that need to be nested properly:
###Example of single sortable list
<div sv-root sv-part="modelArray">
<div ng-repeat="item in modelArray" sv-element>
<div>{{item}}</div>
</div>
</div>###Example of multiple sortable lists with common ancestor
<div sv-root>
<div sv-part="modelArray1">
<div ng-repeat="item in modelArray1" sv-element>
<div>{{item}}</div>
</div>
</div>
<div sv-part="modelArray2">
<div ng-repeat="item in modelArray2" sv-element>
<div>{{item}}</div>
</div>
</div>
</div>###Example of multiple sortable lists without common ancestor
<div>
<div sv-root="someUniqueId" sv-part="modelArray1">
<div ng-repeat="item in modelArray1" sv-element>
<div>{{item}}</div>
</div>
</div>
<div sv-root="someUniqueId" sv-part="modelArray2">
<div ng-repeat="item in modelArray2" sv-element>
<div>{{item}}</div>
</div>
</div>
</div>###Example of using handles
<div sv-root sv-part="modelArray">
<div ng-repeat="item in modelArray" sv-element>
<div>{{item}}</div>
<span sv-handle>`
</div>
</div>###Example of using custom helpers per part
<div sv-root sv-part="modelArray">
<div sv-helper>
custom helper
</div>
<div ng-repeat="item in modelArray" sv-element>
{{item}}
</div>
</div>###Example of using custom helpers per element
<div sv-root sv-part="modelArray">
<div ng-repeat="item in modelArray" sv-element>
<div sv-helper>
custom helper {{item}}
</div>
{{item}}
</div>
</div>###Example of using custom placeholders per part
<div sv-root sv-part="modelArray">
<div sv-placeholder>
custom placeholder
</div>
<div ng-repeat="item in modelArray" sv-element>
{{item}}
</div>
</div>###Example of using custom placeholders per element
<div sv-root sv-part="modelArray">
<div ng-repeat="item in modelArray" sv-element>
<div sv-placeholder>
custom placeholder {{item}}
</div>
{{item}}
</div>
</div>###Example of sorting with images Because images are draggable by default the browser will trigger the default behavior of showing an image's ghost on a drag event rather than the mousedown event listener relied on by this module, disabling that drag behavior leaves the element free to move immediately.
<div sv-root sv-part="photosArray">
<div ng-repeat="photo in photosArray" sv-element>
<img draggable="false" ng-src="{{photo.url}}" />
</div>
</div>| Back | FazBrowse Home | New Git URL |