Why Use Angular?
Let's see why we should use Angular as our web application framework of choice.
Cross-platform framework
Why should a developer learn Angular? Well, there are several reasons, but the main reason is to create applications for all platforms:
- Desktop
- Mobile
- Web
All these platforms are reachable for a developer who knows how to write Angular applications.
Supported by Google
Another reason to use Angular is because Google supports it. They don’t just sponsor the development of Angular; there is a whole team behind the development of Angular. This is unlike other frameworks, which are supported by open source developers who work on fixing issues and creating new features for a framework in their spare time. Angular has a full-time team constantly working on providing maintenance and support to Angular applications
Google has also provided a Long Term Support (LTS) plan for Angular. In this LTS, we can see:
-
What versions of Angular they provide support for
-
When older versions will no longer be supported
With Google being so transparent in terms of their support of Angular, we can be sure that it has a long-lasting future.
This is extremely important for large businesses looking to select the framework they are going to invest in for their next large-scale project. Being able to see that Angular has the support of a large organization like Google and that there is an LTS plan, which shows that Angular will be supported for the long term, makes the decision to pick Angular as their framework of choice a straightforward one.
Built on TypeScript
Angular is built on TypeScript, a superset of JavaScript, built by Microsoft. TypeScript brings so many benefits, including type interfaces and static typing. When we create objects and variables within our code using static typing, the details of these types are known when we compile our code, and this helps to provide useful insights. This way, bugs can be found at compile time instead of runtime.
Note: TypeScript only checks types at compile time while the types of the response from the backend is known only at run time.
Not only does TypeScript help us write better code, but it also allows tools such as VSCode to provide IntelliSense of our code, which gives us:
- Better navigation
- Refactoring
- Autocompletion
This makes the experience of writing TypeScript far more enjoyable than JavaScript.
TypeScript can provide features that are still to be released in JavaScript. So, being built on TypeScript, Angular has access to all the latest features of the language, and all the fantastic tooling TypeScript provides.
The Angular CLI
Another great reason for using Angular is the Angular
- Starting a project
- Creates components, services, directives, and other files using a simple command
- Runs the application in the browser
- Reloads the application after each saved change so that the latest version is displayed in the browser
- It can update a project’s dependencies (other libraries used in a project) automatically
- It can add new libraries to the project
- It can run all the unit tests in a project and the end-to-end tests
The Angular CLI is a great tool, and you’ll see as we proceed that learning it is an important part of developing Angular applications. Many other frontend frameworks don’t have CLIs, and those that do have them don’t support the features of the Angular CLI.
Built on best practices
Angular is designed with best practices in mind. Any code generated by the CLI follows these best practices, as set out by the team from Google. By following the approach prescribed by the Angular team on how to write an Angular application, you know that the application you are building is using the best practices of modern web applications.
These best practices include the following:
- Component-based architecture
- Modularised structure
- Dependency injection
- Testing
- Readable code
- Ease of maintenance
Testing is a first-class citizen of Angular
Testing is an important part of creating bug-free applications. Angular supports testing straight out of the box. Whenever the CLI creates a new Component or Service, it automatically creates a Test Spec file for the new Component or Service. The CLI can also run the tests. No longer do we have to set up test runner files; all of this is automatically managed by the CLI.
Writing and running tests are easy, so there is no reason not to have a good set of tests for your application. Angular actively encourages writing tests, and by doing this, it reduces bugs and issues that an end-user may find.
Ideal frontend framework for enterprise-level application
There are other similar technologies out there; for example, there are many JavaScript frameworks like Angular, but Angular is extremely well established and supported by Google. It is an ideal frontend framework for the enterprise-level application, with all the out-of-the-box features that come with Angular, including:
- Modules
- Classes
- Components
- Unit testing
All of these are important to enterprises wanting their teams to develop well structured, tested applications; that are going to work the first time for their clients.
The Angular community
Another great reason for choosing Angular as your framework of choice is the community that has grown around Angular. There are over 100,000 Angular developers, a number that is still growing. There are Angular meetups all around the world where you can go and meet other Angular developers to discuss their experiences with using Angular.
There are also many conferences you can attend as an Angular developer to learn about the new features of Angular and hear talks on different approaches to working with Angular. These conferences are all over the world and attended by the Angular team, so you can put your questions to the team directly.
Not only are there conferences and meetups you can attend to learn about Angular, but there are also many online resources created by members of the Angular community that we can access to learn about Angular.
There are also podcasts where you hear interviews with leaders of the Angular community, including the Angular team.
There is also a huge ecosystem around Angular, teams such as Nrwl with their Nx Extensions, which allow teams to create libraries to support the large enterprise-level applications that Nrwl specializes in. The NX tool helps the CLI create libraries within Angular projects so that large-scale teams can share code across teams.
Access to third-party libraries
The Angular community, as well as allowing us to learn from one another, is also active in building libraries and tools that work with Angular. Libraries such as NgRx, NGXS, and MobX all provide solutions on how to manage state within an Angular application. There are also UI libraries such as Angular Material, NGX-Bootstrap, and Nebular, which provide UI components you can add to your Angular applications.
There are libraries for accessing data from cloud-based systems, such as Firebase. So, if your application needs to connect to an existing Firebase application, there are libraries you can add that simplify working with Firebase in your application. You can also find libraries that facilitate working with GraphQL if that’s how your team creates their APIs.
If you want to add tools to your Angular workflow, the Angular community has provided tools like Augury, which is a plugin for Chrome that debugs Angular applications.
Another great tool from the Angular community is the NX workspaces from Nrwl. They have created an extension to the Angular CLI that helps to create large enterprise Angular applications, where teams of developers work on the same project. The NX tool helps the CLI create libraries within Angular projects so that large-scale teams can share code across teams.
📝 Note: To see the types of extra resources available for Angular, look at the Resources list on the Angular website.
As you can see, there are so many reasons to use Angular. We’re already on version 11, which shows that the Angular team isn’t slowing down in terms of making Angular better and better.