Google Groups

Closure Library / Closure Compiler + AngularJS


Guido Tapia Nov 26, 2011 3:29 AM
Posted in group: AngularJS
Hi All,

Just saw the GTAC Angular presentation and have spent the last hour going through the web site.  I really like what I see, this resonates with me much more that Knockout or Backbone.  However...

I have a huge code base (read: investment) in the Google Closure Tools.  Has anyone tried to mix the 2?  I mean I can see several obvious pain points:
  • My soy templates would need to be converted (over time of course) to angular templates (which are nicer, so in the long run this hopefully will be worthwhile).
  • There will be a lot of exporting as the angular templates use strings to reference constructor/property/method names (which the closure compiler will of course try to rename).
  • There will be the pain of creating the angular externs file, however this is no big deal.
  • 2 event models, should be ok no? I guess eventually you dont use the closure events any more right? Just let the Angular events + data binding take care of all that stuff.
  • I really like the closure testing libs (Especially all the mocking libs).  Closure testing tools are built on top of JSUnit, I assume testing frameworks are pluggable? Or am I stuck with Jasmine
  • I see that angular.service takes a string.  How would this work when the compiler renames things?
  • Are namespaces supported, I mean in the tutorial I saw all constructors lived in global namespace, can I have things like:  ng:controller="my.super.awesome.namespace.AwesomeController"

Has anyone tried this? Is it doable? Am I setting myself up for disappointment and/or pain?

Thanks all, and great project!

Guido