With no more active development on AngularJS since 2018 I’m amazed at how many big-name websites I find that still use it.

Not to mention that at the time of this writing the AngularJS repository still has more Github stars than Angular. What’s up?

So… here are 5 solid reasons why you should migrate from AngularJS to Angular.

Photo by Jake Hills on Unsplash

Angular Components

An Angular Component allows developers to take a complex web app and break it down into small re-usable pieces of HTML, Javascript and CSS.

Example of how Angular Components are used to build an web application

This makes large applications easier to build by separating all logic into separate pieces. And also easier to debug because unique tests can be written to test a specific component.

The Angular CLI

The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications. You can use the tool directly in a command shell, or indirectly through an interactive UI such as Angular Console. — Angular

The Angular CLI super-power

The Angular CLI simplifies the entire process of generating new apps, services, components and adding new libraries. It is so simple to use that a 4-year old could create an Angular app if they wanted to.

To generate a new app — ng new hello-world

To serve it with hot-reloading— ng serve --open

To add a new component — ng generate component component-name

To add a new service — ng generate service service-name

To add the Material Design Library — ng add @angular/material

To minify, package and build it — ng build --prod

Typescript

When I first discovered Typescript I walked away thinking it was a silly idea. I mean, why would I use Typescript and then compile my code back to JavaScript?

My as well just use good old JavaScript even if it’s cranky sometimes, eh?

That was… until I started using Angular. It takes Typescript and turns it into a powerful front-end language.

Typescript is type-safe which allows me to catch many bugs during development that I’d never catch if I was using plain JavaScript.

Typescript won’t allow developers to pass a number as a parameter to a function that expects a string. However, normal JavaScript would and the function will probably crash or return the wrong value causing weird bugs.

It’s also has the object-oriented features like Java and C# which JavaScript technically doesn’t have.

The benefits of Typescript make it much easier to develop, debug and maintain large projects. Especially when there are many developers working on one project.

Angular Tests

Sure, you can setup tests for your AngularJS app but they don’t come built in. You have to install and configure a testing framework like Karma or Jasmine.

When you create an Angular application, the CLI downloads and installs everything you need to test it with the Jasmine test framework.

Every time you generate a new component or service, the test files are also generated and ready for when the developer wants to write the tests.

And then to run the tests — ng test

Service Workers

At its simplest, a service worker is a script that runs in the web browser and manages caching for an application. — Angular

Most modern web app should have a service worker to do some basic caching.

But… implementing a service worker that manages a local cache can be difficult at times.

However, in Angular all you need to do is run the CLI command ng add @angular/pwa --project *your-project-name* and then edit the ngsw-config.json file to specify which files should be cached and other caching options.

Bingo! You are done setting up your service worker.

Something that a developer might spend hours coding, can be done with Angular in 5 minutes.

Finally…

To sum things up, Angular is an entire framework with all the tools, libraries and best practices baked right into it.

One of my huge frustrations as an AngularJS developer was the variation of coding and design practices I found between projects. The Angular framework is a huge step in providing more consistency and making larger projects easier to manage, debug and deploy.

I hope you found this short article helpful and simple.

Please give it more energy by pounding that 👏 👏 👏 clap button. Thanks!