Over a million developers have joined DZone.

The Unstable Future of Angular.js

DZone's Guide to

The Unstable Future of Angular.js

· Java Zone
Free Resource

Managing a MongoDB deployment? Take a load off and live migrate to MongoDB Atlas, the official automated service, with little to no downtime.

Google's overwhelmingly successful dynamic HTML enhancement, Angular.js, has a flaw that could limit the platform's longevity. While there is nothing inherently wrong about Dependency Injection systems, Adrian Rossouw's recent post explains how some instructions given in the developer's manual cause minification to break down when encountering certain functions. Rossouw states:

The reason that it breaks minification, is that is using some really clever trickery to abuse parts of the javascript language, to do things that conflict with the fundamentals of the language itself.

Specifically, it uses Function.prototype.toString(), to read the source code of the function that is being called, and extract the names that the parameters were given in your source. Because minification changes those variable names, it can no longer rely on that to work.

The following video illustrates exactly how Angular.js breaks in this situation:

It is odd that such a bizarre occurrence exists in an otherwise beautifully constructed platform. Even more baffling is the fact that this option is first in a list of three ways to accomplish the exact same task, and the other two options are perfectly fine. Rossouw provides a colorful explanation of this issue:

On your first day at a new company, you are offered the use of one of three company cars.

As you slip into the red car nearest you, you notice a small sign on the dashboard saying “warning: red cars will explode violently on wednesdays”.

I worry about the fact that something like this is just accepted and people have decided that it’s easier to just warn others about the exploding cars rather than just not giving people exploding cars to begin with. This is expounded by the fact that there are two other perfectly working cars, which might not be your favorite color, but at least they won’t kill you.

The developers of Angular.js agree that this "black magic" is a problem, and have said that the issue will be fixed in the upcoming Angular.js 2.0.

MongoDB Atlas is the easiest way to run the fastest-growing database for modern applications — no installation, setup, or configuration required. Easily live migrate an existing workload or start with 512MB of storage for free.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}