Last active
March 17, 2016 13:35
-
-
Save jbmilgrom/cf90432ff657e8cde587 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
var isVotedGroup = [ | |
'vm.answer.isVotedAgainst(vm.user)', | |
'vm.answer.isVotedFor(vm.user)' | |
]; | |
var unwatch = scope.$watchGroup(isVotedGroup, function(isVotedGroup) { | |
var hasVoted = isVotedGroup.some(function(bool) { | |
return bool; | |
}); | |
if (hasVoted) { | |
vm.answer.disableVoting(vm.user); | |
unwatch(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment