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 Scotch On The Rocks (SOTR) 2011 (Edinburgh) with:

Recent Blog Posts by Ben Nadel

Exposing A Service Directly On The $scope In AngularJS

By Ben Nadel on December 17, 2014

Typically, when I think about the $scope in AngularJS, I think about data that has been explicitly exposed by the Controller for consumption in the view. But what if I had shared data encapsulated within a Service object? Could I simply expose that service on the $scope and then let the View consum... read more »

Binding A Directive To Multiple Compilation And Linking Functions In AngularJS

By Ben Nadel on December 16, 2014

A month ago, I demonstrated that a single directive, in AngularJS, could be bound to multiple priorities on the same element . This has a lot of value; but, at the time, I failed to step back and think about the mechanics of what was actually happening. It turns out, this behavior is bigger than m... read more »

How Often Are Numeric Dates Unique In ColdFusion?

By Ben Nadel on December 15, 2014
Tags: ColdFusion

As you probably know, ColdFusion can represent date/time values as numeric values. Not only can you get the milliseconds-since-Epoch from the underlying Java data/time object, you can also get the fractional-days since December 30, 1899. When dealing with the latter values - fractional days - I was... read more »

Creating A Range-Loop Directive In AngularJS

By Ben Nadel on December 13, 2014

Out-of-the-box, AngularJS allows you to loop over collections; but, it doesn't allow you to perform a simple for-loop. Granted, I've never actually needed a for-loop in production; but, I can definitely see some valid use-cases. And, more than that, I think creating a for-loop would be a fun exerci... read more »

Replacing ngInclude With Component Directives In AngularJS

By Ben Nadel on December 12, 2014

For the last few years, I've been using the ngInclude directive in order to render nested layouts in AngularJS. And, it's been working out quite well. But, last night, Igor Minar - AngularJS team member and wicked smart fellow - challenged me with the idea that ngInclude could be entirely replace... read more »

Deferred Module Definition For 3rd-party Libraries In JavaScript

By Ben Nadel on December 11, 2014

As I've been using 3rd-party tracking libraries in my JavaScript applications, I've noticed an emergent pattern that is kind of cool. The 3rd-party library will provide some sort of super light-weight "proxy" that can be consumed immediately while the actual library loads asynchronously. I've never... read more »

Using ngRepeat With ngInclude Hurts Performance In AngularJS

By Ben Nadel on December 10, 2014

Yesterday, I took a quick look at the performance impact of using directive templates in AngularJS . The impact was small and definitely worthwhile considering the benefits of creating reusable code. Today, however, I wanted to look at another approach to reusing code that does have a significant ... read more »

Directive Templates Have A Small Impact On Performance In AngularJS

By Ben Nadel on December 9, 2014

All developers want to keep their code DRY (Do not Repeat Yourself). But, as with all things computer science, DRYness can be a tradeoff, perhaps for performance. In AngularJS, directive templates allow code to be reused in multiple places; but, what impact does this have on rendering performance? ... read more »

The User Experience (UX) Of Fluffy Data

By Ben Nadel on December 5, 2014

When I design an application, I'd like to believe that every aspect of the user interface contains data that helps solve a real business problem. Otherwise, it's hard to justify why a given detail is there. But, the reality is, as user experience (UX) engineers, so much of the data that we present ... read more »

$q.when() Is The Missing $q.resolve() Method In AngularJS

By Ben Nadel on December 4, 2014

In AngularJS, the $q services has a top-level method, $q.reject(), which will create a promise that is immediately rejected with the given value. Ever since I saw this method, I have always wondered where the "resolve" equivalent was? If there's a $q.reject(), why not a $q.resolve()? Well, it turns... read more »

Using The Scope Tree As A Publish And Subscribe (Pub/Sub) Mechanism In AngularJS

By Ben Nadel on December 3, 2014

When I first got into AngularJS, I wanted to keep the modules of my application synchronized yet decoupled. To do this, I created a centralized "event service" that was used to trigger events in different contexts. This worked; but, as time went on, I came to realize that it would have been much ea... read more »

Use A GetTempFile() Prefix That Links The File Back To The Code That Created It

By Ben Nadel on December 2, 2014
Tags: ColdFusion

When you use the getTempFile() function, in ColdFusion, you can provide a prefix that will be used in the generated filename. According to the ColdFusion documentation, only 3-characters of this prefix value will be used. However, this is often misleading. I suggest using a prefix that contains inf... read more »

GetTempFile() Creates 0KB Files In ColdFusion

By Ben Nadel on December 2, 2014
Tags: ColdFusion

The other day, I happened to notice that a few of our servers had thousands of 0KB files in the temp-directory. After I was able to track down the code that was creating the temp files, I quickly realized what the problem was - the developer thought that the getTempFile() function simply returned a... read more »

Canceling A Promise In AngularJS

By Ben Nadel on December 1, 2014

I've been thinking a lot about something Kyle Simpson said on Twitter a while back - that Promises should not be cancelable. And, while I tend to agree with this, I think there are situations in which the underlying deferred value does need to be canceled. The one that comes to mind is the AJAX (... read more »

Counting The Number Of Watchers In AngularJS - Updated For Isolate Scopes

By Ben Nadel on November 28, 2014

A few weeks ago, I blogged about a bookmarklet that could count the number of Scope.$watch() bindings in an AngularJS page . At the time, the bookmarklet didn't account for Isolate scopes since, frankly, I had very little experience with isolate scopes. This morning, however, I pushed a change to ... read more »

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 »