Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at the jQuery Conference 2010 (Boston, MA) with:

Recent Blog Posts by Ben Nadel

Don't Blindly Isolate All The Scopes In AngularJS Directives

By Ben Nadel on November 27, 2014

From what I have heard on podcasts and read in blog posts, it seems that there is a growing movement, in the AngularJS community, to make all directives isolate-scope directives. While an isolate-scope can be helpful in certain circumstances, applying the isolate-scope without reason is not advised... read more »

Breaking Changes In Isolate-Scope Behavior In AngularJS 1.2

By Ben Nadel on November 26, 2014

With the release of AngularJS 1.2, there was a fairly large breaking change in the way that Isolate-scope directives interacted with child elements in the DOM (Document Object Model). And, while this may not matter to most people using AngularJS, I still run a lot of production code through Angul... read more »

Isolate-Scope Attribute Expressions Use Dependency-Injection In AngularJS

By Ben Nadel on November 24, 2014

When you create an isolate-scope in AngularJS directives, you have the ability to define attribute expressions that can be evaluated in the context of the parent scope. Until you start playing with these attribute expressions, it may not be entirely clear how they work. Not only do they use depende... read more »

Isolate-Scope Two-Way Data Binding Is Eventually Consistent In AngularJS

By Ben Nadel on November 23, 2014

As I've been trying to wrap my head around Isolate scopes in AngularJS , it occurred to me that the two-way data binding might be easy to misunderstand. In two-way data binding, the isolate scope can both read from and write to a given non-isolate scope value. You might think that this relationshi... read more »

How Scope.$broadcast() Interacts With Isolate Scopes In AngularJS

By Ben Nadel on November 22, 2014

After looking at how to unbind scope-event handlers in AngularJS yesterday, I got curious as to how events interact with isolate scopes. I'm still relatively new to isolate scopes, so my mental model isn't super strong. I know they don't "prototypically" inherit data from their parent; but, they'... read more »

Scope.$broadcast() Is Surprisingly Efficient In AngularJS

By Ben Nadel on November 21, 2014

This morning, before writing up my post on how to unbind Scope.$on() event handlers in AngularJS , I took a look at the AngularJS source code. And, much to my delight, I discovered that the implementation of Scope.$broadcast() was much more efficient than I had imagined it would be. My assumption ... read more »

Unbinding Scope.$on() Event Handlers In AngularJS

By Ben Nadel on November 21, 2014

Most of the time, we don't have to think about unbinding Scope.$on() event handlers in AngularJS because they are implicitly unbound when the current scope is destroyed. But, if you think about the scope tree as a built-in pub/sub (Publish and Subscribe) mechanism, you can imagine scenarios in whic... read more »

Using Plupload With Amazon S3 And Imgix In AngularJS

By Ben Nadel on November 20, 2014

Yesterday, I took a look at using Imgix for "web scale" thumbnail generation in ColdFusion . That was fun to see in a one-off manor; but, today, I wanted to look at something a little more real-world oriented. In this exploration, I'm using Plupload to upload images directly from the client to Ama... read more »

Using ImgIX For On-Demand Image Processing At Web Scale In ColdFusion Applications

By Ben Nadel on November 19, 2014
Tags: ColdFusion

Almost every application that I've ever built has required thumbnail generation of some kind. And typically, I'll use ColdFusion as the image generation engine. But, I recently came across ImgIX , which bills itself as "Dynamic Imaging at Web Scale". It's basically a web proxy and CDN (Content Del... read more »

Creating And Extending A Lodash / Underscore Service In AngularJS

By Ben Nadel on November 18, 2014

This is a really minor post, but it represents a pattern for including 3rd-party libraries in an AngularJS application. In this example, I happen to be using Lodash; but, this could just as easily apply to any other external JavaScript library. Since AngularJS relies on dependency injection, I like... read more »

Using Plupload As A Global Uploader In AngularJS

By Ben Nadel on November 17, 2014

For years, I've been using Plupload, as an HTML5 uploader , with great success. But, typically, I use Plupload in a one-off basis. Meaning, one context, one uploader. This works well but, it requires the user to remain in a single context while her files are being uploaded. As an experiment, I wan... read more »

Preventing FileDrop Memory Leaks In Plupload 2.1.2

By Ben Nadel on November 14, 2014

I've been using Plupload in my AngularJS applications for a few years now and it's been totally awesome. But lately, as I've been digging into the Chrome Dev Tools, I've noticed some memory leaks being caused by the FileDrop objects (aka, drop zones) . My code was using the appropriate .destroy(... read more »

scope.$apply() May Return A Value In AngularJS

By Ben Nadel on November 14, 2014

When you're inside an AngularJS directive, and you want to make a change that AngularJS needs to know about, you can call the scope.$apply() method. This evaluates the given expression (in the context of the current scope) and then triggers a digest on the $rootScope. As I was digging through the A... read more »

When To Use $scope vs. scope In AngularJS

By Ben Nadel on November 11, 2014

When I first got into AngularJS, I started using the variable reference, "$scope," everywhere that an AngularJS scope was available. I've kept this practice up for the last two years. Then, a week or so ago, Jonathan Rowny pointed out that I was using "$scope" inappropriately in certain circumsta... read more »

Services And Factories Are Instantiated On-Demand In AngularJS

By Ben Nadel on November 11, 2014

This is a really small post, but something that might not be entirely obvious to people coming into AngularJS - services and factories are instantiated on-demand, when they are required (ie, injected) in some other context, like a Controller. For app setup, this is usually a non-issue; but, if you ... read more »

Using Variables Into XPath Queries In ColdFusion

By Ben Nadel on November 10, 2014
Tags: ColdFusion

In ColdFusion 10, xmlSearch() added support for XPath 2.0 syntax and passing variables into XPath queries. Using variables can make the query more readable; but, since XML is case-sensitive, it took me a few minutes to get it working. As such, I figured I'd put together a quick demo on using variab... read more »

Using Multiple Predicates In The Same Part Of An XPath Query In ColdFusion

By Ben Nadel on November 8, 2014
Tags: ColdFusion

The other day, Will Belden asked me a question about XPath expressions in ColdFusion. Specifically, how to select an XML node based on the existence of multiple child nodes. This seemed like a problem that could be solved using multiple predicates in the same part of the XPath query; but, in the ... read more »

Refactoring bnRepeatSwitch To Use A Multi-Priority Directive In AngularJS

By Ben Nadel on November 7, 2014

Yesterday, I demonstrated that a single directive could be bound to multiple priorities in the same compile and linking phase in AngularJS . While the coolness of this may not be obvious, I immediately thought of my previous post on the ngRepeat-optimized "switch" directive . It used two directiv... read more »

Binding A Single Directive To Multiple Priorities On The Same Element In AngularJS

By Ben Nadel on November 6, 2014

Last night, I was looking through the AngularJS source code when I noticed that the ngInclude directive was defined twice. At first, I had no idea what to make of this craziness; but then, I realized that each version of the directive was given a different priority. I had no idea that this was poss... read more »

Implementing Controller-As Using A Directive In AngularJS 1.0.8

By Ben Nadel on November 4, 2014

After implementing the "Track-By" feature of AngularJS 1.2 using a directive in AngularJS 1.0.8 , I wanted to see if I could do the same thing for the relatively new "Controller-As" feature. The "controller-as" syntax makes the controller instances available in the View-Model using the provided ... read more »

Directive Controllers Can Use Dependency Injection In AngularJS

By Ben Nadel on November 3, 2014

Over the weekend, I read a very thought provoking post by Tero Parviainen on removing ngController from his AngularJS applications . And, while I am still "digesting" his approach, I must admit that his code pointed out an AngularJS feature that I had not see before - directive controllers can b... read more »

Exceptions Are For Exceptional Circumstances Is Not A Value-Add Answer

By Ben Nadel on October 31, 2014

In the world of programming, there are a lot of "answers" that feel like they lack any substantial value-add. "It depends," for example, is a response that typically doesn't clarify anything. Another response that sticks in my craw is that "exceptions are for exceptional circumstances." This is a r... read more »

Implementing ngRepeat Track-By Using A Directive In AngularJS 1.0.8

By Ben Nadel on October 30, 2014

For me, one of the most exciting features of AngularJS 1.2 is the "track by" syntax that was added to ngRepeat . This feature allows ngRepeat collections to be updated without the costly overhead of DOM (Document Object Model) node destruction and recreation. Unfortunately, I'm still using a lot o... read more »

Always Trigger The $destroy Event Before Removing Elements In AngularJS Directives

By Ben Nadel on October 29, 2014

If you're building custom AngularJS directives, you will inevitably find yourself in a situation where you have to clone elements, create new scopes, remove elements, and destroy old scopes. When you do this, the order of operations is very important. At first, it may not seem like an issue; but, o... read more »

A Quick Look At How DOM Structure Affects Text Interpolation Watchers In AngularJS

By Ben Nadel on October 27, 2014

I spend a lot of time thinking about how to improve the performance of my AngularJS apps. Not in a "premature optimization" way - more like in a "customers are complaining" kind of way. As such, I like to stop and noodle on any aspect of the code that may be leveraged for better performance. This m... read more »

Deferring Attribute Interpolation In AngularJS For Better Performance

By Ben Nadel on October 25, 2014

When AngularJS interpolates attributes on the DOM (Document Object Model), it has to install a $watch() binding in order to update the attribute value whenever thew View-Model (VM) changes. This can quickly lead to a very large number of watchers that execute in every digest. At some point, this ca... read more »

You Cannot Link Attribute Interpolation Multiple Times In AngularJS

By Ben Nadel on October 23, 2014

Once you have a compiled directive, in AngularJS, you can either link it to the current scope; or, you can clone the compiled template and link each new clone to a different scope. But, what if we didn't want to clone the template? What if we just wanted to move it around in the DOM (Document Objec... read more »

Creating An Optimized Switch Directive For Use With ngRepeat In AngularJS

By Ben Nadel on October 20, 2014

Yesterday, I looked at how to use a single ngRepeat directive, in AngularJS, to render a list of commingled datasets . In that approach, I used the ngSwitch and ngSwitchWhen directives. While this worked perfectly well, I was concerned that it was causing much of the DOM (Document Object Model) to... read more »

Mixing Data And Templates Using A Single ngRepeat In AngularJS

By Ben Nadel on October 19, 2014

Most of the time, each ngRepeat directive in AngularJS renders a single, homogeneous set of data. But sometimes, the user interface (UI) of your application requires a list to contain several commingled sets of data. In such cases, not only do the individual subsets of data contain potentially-over... read more »

Individual Firebase References Don't Store Unique Event Bindings

By Ben Nadel on October 17, 2014

After my exploration this morning, on the data synchronization behavior in Firebase , I started to wonder about the relationship between unique Firebase instances and event bindings. Specifically, how do event bindings on one instance affect the event bindings on another instance. As it turns out,... read more »