
How do I “think in AngularJS” if I have a jQuery background? - laurent123456
http://stackoverflow.com/q/14994391/561309
======
danso
A couple months ago I created an Angular app just to try it out for myself
(only NYCers will find it useful:
[http://summerstagelove.com](http://summerstagelove.com)) and it was the first
Javascript-using website, since having learned jQuery 5+ years ago, that I've
made that doesn't include jQuery...I tried for awhile to get jquery.isotope.js
to work but didn't know enough about the order of callbacks and such in
directives, so just left it out entirely.

I've developed enough Rails apps to think architecture-first...but thinking
back in my jQuery only days, the OP's question seems like it'd be a very
common one among jQuery-only-front-end developers...and the top-answer is
excellent: if you don't include jQuery, then you're forced to think about the
architecture, and you'll be better off for it as a developer.

~~~
adamnemecek
Not to nitpick but by including angular you are including jqlite which is a
subset of jquery. But yeah, your point still stands.

~~~
joshuacc
But it is a very, very small subset. :-)

------
rzendacott
I'm very glad to see that this answer hasn't been closed as not constructive!
It seems like most popular questions like this are, even though they're
incredibly useful and insightful.

I was leaning toward learning Ember, but this post makes me really curious
about Angular. In particular, the ease of testing has my interest piqued. Is
testing as simple/easy with Ember? I know that unlike Angular, Ember doesn't
have DI as a core feature. Either way, I should probably just flip a coin and
start learning!

~~~
benatkin
I was disappointed that it hadn't been closed. The first answer is a
backhanded dig at non-angular developers saying that angular is about
architecture and implying that the others aren't.

I like angular but "angular architect" rolls off the tongue too easily.

~~~
jamesaguilar
You're disappointed that a really informative answer has not been closed
because of some subtext you've read into it that may or may not actually be
there? That doesn't seem like a very productive attitude to me.

~~~
benatkin
Another google employee. You're just contributing to the mutual admiration
society that's all over that answer and its comments.

~~~
jamesaguilar
The answer was made by a Google employee? Never knew.

~~~
benatkin
Actually, no, the person who wrote the so-called "answer" which is more like
an essay (and therefore not a proper Stack Overflow response) isn't a google
employee. I didn't mean to imply that.

~~~
jamesaguilar
OK, then I'm unclear on why you brought up my employer. Did it have something
to do with my support of the answer in your mind? Like is Angular a Google
project? Or was it just some random thing you could attack?

~~~
benatkin
That's funny. You rushed to Angular's defense without mentioning your
financial connection and now you're annoyed that somebody else mentioned it.

~~~
jamesaguilar
Ah, that is your way of answering, "Yes, Angular is a Google project." I was
not aware of that. I am not annoyed, just confused.

------
thangalin
How well do screen readers for the blind and AngularJS play together?

I thought that JavaScript-based frameworks are often not very compatible with
screen reading technologies, but have not investigated what advances have been
made for the blind in this area.

[http://stackoverflow.com/q/15318661/59087](http://stackoverflow.com/q/15318661/59087)

[http://juicystudio.com/article/making-ajax-work-with-
screen-...](http://juicystudio.com/article/making-ajax-work-with-screen-
readers.php)

~~~
steveklabnik
This post is about Ember, but in sure it's not much different:
[http://words.steveklabnik.com/emberjs-and-
accessibility](http://words.steveklabnik.com/emberjs-and-accessibility)

~~~
thangalin
The [http://vimeo.com/59124303](http://vimeo.com/59124303) link is
illuminating, as is the WAI-ARIA specification from [http://www.w3.org/TR/wai-
aria/](http://www.w3.org/TR/wai-aria/).

------
gohrt
This answer convinces me to prefer jQuery for apps that aren't Facebook or
Gmail.

It has an "architecture astronaut" feel (explicitly eschewing graceful
degradation!), which most web pages don't need.

I'd be interested in "controller" plugins for jQuery, so I can opt into
upgrading from trigger->DOM to trigger->controller->DOM as my app grows.

~~~
macspoofing
It shouldn't. AngularJS should work great in most situations, even for simpler
pages. I'm a big fan of MVVM pattern as it lends itself to a hard separation
between the nitty-gritty view details (e.g. effects, transitions, styles,
etc.) and the rest of your business logic. Create your view, declare how it
should behave based on view-model values and then hook it up to your core
business logic that is now completely agnostic to your view details. jQuery,
on the other hand, forces you down the path where your business logic needs to
care about how the view should render the content, and those ugly view details
are sprinkled all over the place.

~~~
wwweston
Forces?

Angular is pretty cool, but it's hardly the only neat way of seperating and
offloading view detail work.

And jQuery is just a (much) nicer-than-native DOM/browser API. It doesn't
provide an application architecture or data bound view handling layer because
that's not what it's for, and it no more forces an application style than your
text editor does.

This isn't to say that Angular isn't nice for projects short of Gmail's scale
(I would/am considering it for some small scale stuff), it just doesn't make
much sense to say jQuery forces people a direction by not providing features
that aren't really part of its purpose.

~~~
macspoofing
You can write maintainable code in any language, but certain languages,
frameworks, and libraries lend themselves to certain patterns. It's very easy
to do the wrong thing with jQuery.

------
joshavant
'How do I "think in X" if I have a Y background" seems like an incredible
programming blog/book idea.

I, for one, constantly find myself thinking along the same lines whenever I
try out a new language.

~~~
Jach
Indeed. Rich Hickey's 2-part presentation on "Clojure for Java Programmers"
was a really slick presentation of a Lisp. (Focusing on the 'code is data'
aspect from the beginning (at least once he starts talking about the language
specifics themselves, he does spend a while motivating dynamic languages)
rather than talking a lot about just higher order functions and macros and so
on. He goes over the evaluation model and its difference from a Java/C++
model, he shows how to interop with Java... It's just a great talk.)

Part 1:
[http://www.youtube.com/watch?v=P76Vbsk_3J0](http://www.youtube.com/watch?v=P76Vbsk_3J0)

Part 2:
[http://www.youtube.com/watch?v=hb3rurFxrZ8](http://www.youtube.com/watch?v=hb3rurFxrZ8)

Slides: [http://www.slideshare.net/adorepump/clojure-an-
introduction-...](http://www.slideshare.net/adorepump/clojure-an-introduction-
for-java-programmers)

------
wes-k
I was lucky enough to read this when I first got started with angular. Huge
help shifting your mindset to angular and seeing the advantages it provides.

I'd also recommend [http://egghead.io](http://egghead.io) for some in depth
walk throughs.

~~~
j_s
This extensive list is still updated regularly:
[https://github.com/jmcunningham/AngularJS-
Learning](https://github.com/jmcunningham/AngularJS-Learning)

------
jacques_chester
So far I've spent several weeks of my spare time forensically decomposing the
documentation, nearly line by line. It's been very slow going.

The main thing I've learnt is that Angular is elaborate. Each time I get my
head around something, I realise that my previous understanding was utterly
wrong.

The docs are sufficiently vague that I spend a lot of time looking for
secondary sources or just reading the code directly. Sometimes the code is
self-documenting. And sometimes it's neutron-star dense.

But what I'm seeing, I really like. I think that directives are a big part of
the magic -- building the HTML you _wish_ existed and then writing your app in
that domain-specific HTML.

~~~
Chris2048
I tried to get into angular, but it seemed to hard beyond the tutorials.
Aren't frameworks supposed to make things easier?

~~~
jacques_chester
They're meant to make particular kinds of complex application easier. I think
Angular's problems is that docs are frankly dreadful. They tell people to fork
it and improve it, but go look at their github pull requests. There are
hundreds.

------
TheHippo
The first answer should be part of the official documentation.

------
junto
The first answer is really so well written it was worth yet another upvote.

------
JeremyMorgan
It's answers like these that make SO an invaluable resource. They should award
bonus points for stuff like that.

~~~
neon_electro
Looks like there's a bounty in place, so the best answer will get some bonus
points :)

~~~
manojlds
Does it matter? You can only get 200 reps (from upvotes) per day. And the 50
bonus is nothing in front of all the upvotes

~~~
recursive
You can get 500 for a bounty.

~~~
manojlds
But the bounty in this case was 50.

------
VeejayRampay
Maybe it's because of my background with Backbone.js but Angular really
doesn't feel right. Any way I look at it, it feels like HTML and JS is being
miished mashed together all over again and I thought we were past this way of
doing things.

~~~
dchuk
Neither way (Angular or Backbone) is "right" or "wrong"...just different ways
to solve the same problems.

Angular reduces the amount of boilerplate code you need to build nice
applications immensely, but to get to that point (and beyond two way binding
hello world demos) there's a nearly vertical learning curve.

Once you near the top of that curve though, apps just kind of come together
like magic. It's really neat.

------
isaacb
The cool thing about Angular is that it introduces a pretty unique way of
building applications. What people don't seem to get is that it isn't mutually
exclusive with jQuery. You can use Angular and still pull in the full jQuery
library for your directives. What you'll find, however, is that you don't
really need much more than the jqLite library that ships with Angular. The
"Angular Way" alleviates the need for the more involved DOM functions in
jQuery.

------
tocomment
I'm curious if anyone could point me to a really simple application that shows
how to use AngularJS and Firebase together?

I'm thinking it makes sense to do my next project in those technologies since
that way I can avoid setting up a hosting platform entirely and not even pay
for hosting? Does that seem like a good idea? (It's going to be a way people
can pay bitcoins to other people to read books)

~~~
marknutter
I actually do exactly this for a site I'm building. I use Firebase and Angular
together and I host the site for next to nothing using Amazon's S3 static
hosting option (costs me like $2 a month). I wrote a more robust angular
firebase module than angular-fire, the one the Firebase guys wrote, and I also
created a tiny framework/script-runner similar to Yeoman that automates a
bunch of stuff including deploying to S3.

I'll message you when I make it all publicly available.

~~~
tocomment
Yes, let me know when it's available.

I thought you could host your HTML file on firebase too? Why do you need S3?

~~~
anant
Firebase only stores data at the moment, to store the static assets, you'll
still need a service like S3, Github Pages, Site44, or Harp.IO.

------
guiomie
I've just started using angular.js lately.

One of the best advice I read was not to use jquery with angular.js, and I
couldnt agree more.

My question now is, why would I ever want to use jquery and angular.js
together? I can do everything I needed to do before in jquery with angular.js

~~~
defen
Only time I've used jQuery with angular.js is when I've needed to use a
jQuery/jQuery UI plugin that I didn't feel like rewriting.

------
sluukkonen
There is a simple todo app example on the angularjs homepage. It's one of the
first examples there.

------
akadien
Angular.js makes me hate Javascript.

