Skip to content

Instantly share code, notes, and snippets.

Jonathan Milgrom jbmilgrom

Block or report user

Report or block jbmilgrom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View type-conversion-filters.js
.filter('nullify', function(){
return function(value){
return value ? value : null;
};
});
View nullify-model-consumer.html
<input type="text" ng-model="modelName" nullify-model>
View nullify-model.js
.directive('nullifyModel', ['$filter',
function($filter){
return {
restrict: 'A',
require: "ngModel",
link: link
};
function link(scope, elem, attrs, ctrl){
ctrl.$parsers.push($filter('nullify'));
View ngclick.html
<i class="icon upvote" ng-click="vm.user.upvote(vm.answer)"></i>
View upvote.html
<i class="icon upvote"
ng-click="vm.user.upvote(vm.answer)"
ng-class="{voted: vm.answer.isVotedFor(vm.user)}">
</i>
View upvote.html
<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>
View watchGroup.js
scope.$watchGroup(['expression1', 'expression2'], function(arrayOfExpressions) {
...
});
View watchGroupUpvoteExample.js
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) {
View ithinkTherefore.js
var o = {iThink: ‘thereforeIAm’}; // memory allocated for an object and a string
View ithinkTherefore2.js
var o = {iThink: ‘thereforeIAm’}; // memory allocated for an object and a string
o = ‘helloImANewString’;
You can’t perform that action at this time.