Created
July 31, 2015 09:18
-
-
Save Hultner/1eec1c928f7048e809b7 to your computer and use it in GitHub Desktop.
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
# 1st list adapter implementation | |
$scope.firstListAdapter = remain: true | |
$scope.updateList1 = -> | |
$scope.firstListAdapter.applyUpdates (item, scope) -> | |
item.content += ' *' | |
$scope.removeFromList1 = -> | |
$scope.firstListAdapter.applyUpdates (item, scope) -> | |
if scope.$index % 2 == 0 | |
return [] | |
idList1 = 1000 | |
$scope.addToList1 = -> | |
$scope.firstListAdapter.applyUpdates (item, scope) -> | |
newItem = undefined | |
if scope.$index == 2 | |
newItem = | |
id: idList1 | |
content: 'a new one #' + idList1 | |
idList1++ | |
return [ | |
item | |
newItem | |
] | |
return | |
# 2nd list adapter implementation | |
$scope.updateList2 = -> | |
$scope.second.list.adapter.applyUpdates (item, scope) -> | |
item.content += ' *' | |
$scope.removeFromList2 = -> | |
$scope.second.list.adapter.applyUpdates (item, scope) -> | |
if scope.$index % 2 != 0 | |
return [] | |
idList2 = 2000 | |
$scope.addToList2 = -> | |
$scope.second.list.adapter.applyUpdates (item, scope) -> | |
newItem = undefined | |
if scope.$index == 4 | |
newItem = | |
id: idList2 | |
content: 'a new one #' + idList1 | |
idList2++ | |
return [ | |
item | |
newItem | |
] | |
return | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment