Last active
October 2, 2015 17:46
-
-
Save finalcut/0841dbf0794326105a5d to your computer and use it in GitHub Desktop.
SortableController
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
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