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
<input type="text" ng-model="modelName" nullify-model> |
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
.directive('nullifyModel', ['$filter', | |
function($filter){ | |
return { | |
restrict: 'A', | |
require: "ngModel", | |
link: link | |
}; | |
function link(scope, elem, attrs, ctrl){ | |
ctrl.$parsers.push($filter('nullify')); |
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
.filter('nullify', function(){ | |
return function(value){ | |
return value ? value : null; | |
}; | |
}); |
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
<i class="icon upvote" ng-click="vm.user.upvote(vm.answer)"></i> |
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
<i class="icon upvote" | |
ng-click="vm.user.upvote(vm.answer)" | |
ng-class="{voted: vm.answer.isVotedFor(vm.user)}"> | |
</i> |
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
<i class="icon upvote" | |
ng-click="vm.user.upvote(vm.answer)" | |
ng-class="{voted: vm.answer.isVotedFor(vm.user)}"> | |
</i> | |
{{ vm.answer.voteCount() }} | |
<i class="icon downvote" | |
ng-click="vm.user.downvote(vm.answer)" | |
ng-class="{voted: vm.answer.isVotedAgainst(vm.user)}"> | |
</i> |
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
scope.$watchGroup(['expression1', 'expression2'], function(arrayOfExpressions) { | |
... | |
}); |
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) { |
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 o = {iThink: ‘thereforeIAm’}; // memory allocated for an object and a string |
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 o = {iThink: ‘thereforeIAm’}; // memory allocated for an object and a string | |
o = ‘helloImANewString’; |
OlderNewer