Showing posts from September, 2015

Marvel '70s Style Packaging

Found these at Target last week. Was surprised they used the classic '70s artwork for these characters rather than anything newer.
I ended up buying these just because I liked the packaging -- but the granola bars are actually pretty good. :)

Angular Filter Negate Predicate Issue And Workaround

I recently ran into a funny quirk when attempting to specify a predicate negating condition on a filter in Angular.js.

According to the Angular docs:
The predicate can be negated by prefixing the string with!. For example {name:"!M"} predicate will return an array of items which have propertyname not containing "M".

First, here's what I was attempting to do:

<div ng-repeat="section in newsletter.sections | filter: { sectionType: !1 } | orderBy:['region','order']">

In the example above, I'm attempting to filter out any sections of my newsletter object which have a sectionType other than 1. However, this wouldn't do the trick.

The workaround was to append the exclamation mark as a string, as shown below:

<div ng-repeat="section in newsletter.sections | filter: {sectionType: '!' + 1} | orderBy:['region','order']">

I guess when they said "prefixing the string", they meant that…