DEV Community

loading...

Explain like I'm five: AngularJS and when you'd use it.

andrewsmith1996 profile image Andrew Smith ・1 min read

Discussion

pic
Editor guide
Collapse
isaacdlyman profile image
Isaac Lyman

AngularJS is a big piece of JavaScript code that helps you build applications that run on websites. Here's some of what it gives you:

  • Rules for dividing a complicated web application into small parts (templates, controllers, services, filters, and more -- each of these is just a logically separated, purpose-built piece of code).
  • Dependency injection, which you won't have to think about much, but it makes it easier to write unit tests.
  • Extra HTML syntax to help you tie HTML elements and model data together, so that when the value of a variable changes, the web page automatically updates certain elements.
  • A one-stop-shop set of tools for common things apps need to do, like make AJAX requests or change the page based on the URL route.
  • A common basis for building plugins. Any web component you might want to build is probably already available via some Angular plugins.

You'd use AngularJS if you joined a team that maintains an old project that was built with AngularJS. You probably wouldn't ever use AngularJS on a brand new project; it has problems with performance and maintainability that can increase as projects grow.

When AngularJS first came out, it was a big deal because it was more ambitious than many other web frameworks and it had the support of Google, which built a lot of hype and excitement around it. But now there are a few frameworks that make more sense to use for new projects, such as Angular (the new version of AngularJS), React, and Vue.

For very small projects, you may not need any framework. But if you're working on a long-lived project with lots of features and several developers, a framework is a good way to keep things standardized so everyone understands what's going on.