Live data from Hacker News

Using AngularJS at Localytics

localytics.com

51–59 of 59 posts

Re: Using AngularJS at Localytics

#51
We've got a very large app built on Angular, and it has been a real pleasure to work with. The directives are the killer feature for me. There are some definite esoteric bits that can be puzzling at first, but after you crest the hump it is rad. I love it.

Re: Using AngularJS at Localytics

#52
post #10

We used to write things like Then we realized it was bad to couple presentation and behavior, so we made our Javascript unobtrusive, keeping our templates clean. But now we’re back at it again, writing . Have we learned nothing? --- This seems like a good point that I can't refute - anyone?

Separating content from presentation matters.

For documents.

Applications are not documents.

Re: Using AngularJS at Localytics

#54

For those commenting on the poor quality of Angular's documentation (a complaint I share), check out John Lindquist's videos at http://egghead.io/ . They're not comprehensive, but John spends a great deal of time explaining the nuances of directives, especially isolate scopes and transclusion and his explanations are clear and intuitive. Prior to finding John's videos, I watched all of the "official" Angular videos w…

it is http://egghead.io alive ? It seems down at the moment.

See above, John is working on a re-design: https://twitter.com/eggheadio/status/322062696583413761

Re: Using AngularJS at Localytics

#55
Love AngularJS. My grips so far :

- Directives : I'm no JS ninja so even after those egghead.io I'm still lost, but it gets better !

- jQuery : Angular kinda want to kill it whereas I think it should play nicer with it, especially for plugins. AngularUI jQuery Passthrough (or custom directives) should not be necessary IMO.

- Expressions : they are powerful but there is almost no documentation about them and I feel like an idiot sometimes. Thank god for Stack Overflow ... (where in the Angular doc can I learn that I can do ng-click="[action_1, action_n]" ?).

- Views helpers are usually put in the controller. That doesn't seem the best approach, or maybe people put them in a service and inject it in the scope from the controller ?

- Providing initial data : I usually put data in javascript variables and get them in the controller and assign them to services or the scope. Is there a better way ?

Re: Using AngularJS at Localytics

#56
Stickit author, here. To be clear, stickit will not make your "zombie views grow fatter" or contribute to any memory problems. In fact, stickit cleans up all of its model and view bindings automatically on view.remove(), and provides an optional api for manual cleaning view.unstickit().

The blog author's problem was a brief bug that was introduced and fixed between releases for the rare use case when a data-bound view is re-rendered. We fixed this problem and the author confirmed that the patch was "working great."

https://github.com/NYTimes/backbone.stickit/issues/66

So even though the problem was fixed for the blog author before he moved onto angular, he still claims that stickit causes memory problems. I guess a false claim like that makes the story of moving to a new framework more entertaining.

Another claim from the blog author is that stickit makes it hard to use third-party plugins like Chosen. Around the same time he filed the github issue, we were finishing and getting ready to release "handlers" and a new "initialize" binding which give you the ability to create global handlers for setting these kinds of bindings up. More on handlers here:

http://nytimes.github.io/backbone.stickit/#custom-handlers

... and an example of setting up a global handler for Chosen:

http://jsfiddle.net/px6UP/28/

Re: Using AngularJS at Localytics

#57

Earlier quoted context omitted.

why?

I'm not sure why the OP links advance compiling specifically to mobile. It's good to have smaller, faster code on any platform that isn't quad Xeon with a fiber connection. The Closure ecosystem has their own templates (soy) which are compiled in Advance Mode (with renaming) by the Closure Compiler. It's not possible to do that with Angular attribute's which reference JS names. See this conversation about Angular sup…

you touched on several of the problems i forsee. angular parses templates client side, which is expensive IMO, smaller better optimised code with proper dead code elimination leads to a faster experience. as for mobile, i use it as the final use case, where the bad decisions which you make get amplified the most.

Re: Using AngularJS at Localytics

#58
post #10

We used to write things like Then we realized it was bad to couple presentation and behavior, so we made our Javascript unobtrusive, keeping our templates clean. But now we’re back at it again, writing . Have we learned nothing? --- This seems like a good point that I can't refute - anyone?

The difference is onclick="doSomething()" runs doSomething() in the global scope. Not good!

ng-click="doSomething()" runs doSomething() in the scope of the controller that contains the element. Good!

Re: Using AngularJS at Localytics

#59
post #37
post #10

We used to write things like Then we realized it was bad to couple presentation and behavior, so we made our Javascript unobtrusive, keeping our templates clean. But now we’re back at it again, writing . Have we learned nothing? --- This seems like a good point that I can't refute - anyone?

The alternative is a slew of loosely-coupled and opaque attributes (IDs and classes), especially where you're not sure if a particular class or ID is used for presentation (CSS) or functionality (JS). How do you handle refactoring when you use some classes for JS and some for CSS? With custom attributes there is no confusion, and although it goes completely against the separation of concerns and now your mark-up isn'…

What about some kind of Hungarian notation for classes?

pBlue bWidget?

I've never done this, just wondering.

Post reply on HN