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 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 type-conversion-filters.js
.filter('nullify', function(){
return function(value){
return value ? value : null;
};
});
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 watch.js
scope.$watch('greeting', function(greeting) {
console.log('greeting: ', greeting);
});
scope.greeting = 'hi there'; // greeting: hi there
$timeout(function() { scope.greeting += ', Joe'}); // greeting: hi there, Joe
View watch(__,__,true).js
scope.tree = {
type: 'oak',
branches: [{
color: 'brown',
length: '11',
leaves: [{
color: 'green',
shape: 'oval',
}, {
color: 'brown',
View object-ref-watch.js
scope.$watch('obj1', function callback(newValue) {
console.log('obj1: ', newValue);
});
// (when initialized) prints out: undefined
$timeout(function() {
scope.obj1 = {name: 'jonathan'}; // prints out: {name: 'jonathan'}
});
View watchGroup.js
scope.$watchGroup(['expression1', 'expression2'], function(arrayOfExpressions) {
...
});
You can’t perform that action at this time.