Angular uses some tricks for its dependency injection that can break under some
minifications:
http://stackoverflow.com/questions/18782324/angularjs-minify-best-practice
You can tidy that syntax up in cljs via a macro:
(defmacro fng
"Similar to fn, but expands into Angular-minifier-safe version, a JavaScript
array of argnames with fn in last position."
[args & body]
`(~'array ~@(map str args) (fn ~args ~@body)))
On Sunday, April 6, 2014 3:44:33 AM UTC-7, Ivan Schuetz wrote:
> Ah... right! I was using advanced optimizations. Changed it to:
>
>
> :optimizations :simple
>
> Now it works.
>
> But why do advanced optimizations break the code? Is it buggy?
>
>
>
>
>
>
> Am Sonntag, 6. April 2014 11:27:58 UTC+2 schrieb David Della Costa:
> > Are you using advanced compilation?
> >
> >
> >
> > (2014/04/06 6:49), Ivan Schuetz wrote:
> >
> > > I just started learning ClojureScript.
> >
> > >
> >
> > > It seems my ClojureScript syntax for application module initialisation is
> > > not correct.
> >
> > >
> >
> > > In Javascript, it has to be:
> >
> > >
> >
> > > angular.module('F1FeederApp', [
> >
> > > 'F1FeederApp.controllers'
> >
> > > ]);
> >
> > >
> >
> > >
> >
> > > I wrote in ClojureScript:
> >
> > >
> >
> > > (.module js/angular "myprooooj" (array "myproj.controllers"))
> >
> > >
> >
> > > And I get in JS:
> >
> > >
> >
> > > angular.Mb("myprooooj", ["myproj.controllers"]);
> >
> > >
> >
> > > This causes an error, since Mb isn't a property of Angular, and I have
> > > not idea where this comes from.
> >
> > >
> >
> > > I looked for an example online, I found e.g. this gist:
> > > https://gist.github.com/lynaghk/3856153 , which is pretty much the same:
> >
> > >
> >
> > > (def todomvc
> >
> > > "Create a TodoMVC module within Angular.js"
> >
> > > (.module js/angular "todomvc" (array)))
> >
> > >
> >
> > >
> >
> > > Same JS, same error:
> >
> > >
> >
> > > angular.Mb("todomvc", []);
> >
> > >
> >
> > >
> >
> > > What am I doing wrong? According to sources I read this syntax should be
> > > correct.
> >
> > >
> >
> > >
> >
> > > Thanks.
> >
> > >
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.