Skip to content

Instantly share code, notes, and snippets.

@jbmilgrom
Last active March 17, 2016 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbmilgrom/cf90432ff657e8cde587 to your computer and use it in GitHub Desktop.
Save jbmilgrom/cf90432ff657e8cde587 to your computer and use it in GitHub Desktop.
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