Skip to content

Instantly share code, notes, and snippets.

@finalcut
Last active October 2, 2015 17:46
Show Gist options
  • Save finalcut/0841dbf0794326105a5d to your computer and use it in GitHub Desktop.
Save finalcut/0841dbf0794326105a5d to your computer and use it in GitHub Desktop.
SortableController
export default class SortableController {
static get $inject() { return [
'$scope'
];}
constructor($scope){
this.$scope = $scope;
this.tmpList = [];
for (let i = 1; i <= 6; i++){
this.tmpList.push({
text: 'Item ' + i,
value: i
});
}
this.list = this.tmpList;
this.sortingLog = [];
this.sortableOptions = {
stop: this.itemMoved
};
}
itemMoved(event, ui){
// i need to get access to the controller here.
let logEntry = this.tmpList.map(function(i){
return i.value;
}).join(', ');
this.sortingLog.push('Stop: ' + logEntry);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment