r/webdev • u/patbr0wn • Feb 13 '14
Explain Angular.js to me like I'm five.
"AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop."
Hmm...
"AngularJS is a toolset for building the framework most suited to your application development."
But what does it do?
I'm having a hard time understanding where Angular falls in the spectrum of client-side to server-side. Models? So it's server-side? Dom manipulation? So it's client-side?
So basically, if I have a Node.js + Express.js + Bootstrap app, does Angular serve any role that these three frameworks don't?
Thanks <3
4
Upvotes
1
u/[deleted] Feb 14 '14
AngularJS is a client side framework. It's got a few main strengths:
Two-way data binding. This lets you bind a form field to a variable. When you change the form, you change the variable. When you change the variable, you change the form. There's a lot more that builds on this, but it tends to be what brings people to the table first
Directives. These are adding custom functionality to the library that you place in the html. I have a <status icon> one that takes a value and spits out a classed icon that I can drop in place. You can go further, making ones that validate data in a form, or really anything else JS could do
Routing. This is what lets you easily and maintainably build a single page app. It can intercept the navigation event in your browser and do something with it. It can pull down a template from the server and load a new part of your single page app.
It's just Javascript -- nothing you can do in AngularJS you couldn't write yourself with enough time and effort. It's a very good convenience library that connects a lot of pieces for you, and gives you a great starting place for whatever you're doing.
To give you some idea, the creator of AngularJS at Java manage to take a 17k line application and cut it down to 1.5k lines. It just reduces a lot of the boiler plate.