How does Angular JS relate to Google Closure?

The only Google project I’m aware of that uses AngularJS is the DoubleClick team. (presentation) Essentially, they still use Google Closure Library for everything but the UI building. Also note that they use Google Closure Compiler, but that’s almost a given, “nobody” uses only the Library without the Compiler.

Google Closure Library comes with a UI framework in its goog.ui namespace. This framework compares in almost every way to non-web UI frameworks like Android, iOS, Swing and QT. They have a thing I like to call DOM elements on steroids, goog.ui.Component, which has lots of great life cycle mechanisms for garbage collection and event listening and more. You have things like goog.ui.Control, which is a subclass of goog.ui.Component, and handles user interaction in a very interesting way. It lets you plug renderers, for example, so you can change a <button> to an <a> without changing any of your other logic except the actual rendering.

Speaking of classes and subclasses, Google Closure Library also has this. You don’t have to use the built-in one, the important part is that you somehow call the prototype of the “superclass” in your methods. You can for example use the class system in CoffeeScript, Google Closure Library doesn’t care.

The reason the DoubleClick team chose AngularJS was apparently largely because of the data binding features AngularJS provides. There’s nothing built-in in Google Closure Library to automatically update the UI when data changes.

So to summarize, Google Closure is a huuuuge beast, and AngularJS can replace the goog.ui part of the Google Closure Library.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)