DEV Community

Cover image for 10 tips for the Angular developer
Diego López
Diego López

Posted on

10 tips for the Angular developer

Today I'm going to tell you 10 tips for any Angular developer.


Try to have more or less clear the structure that the project is going to have, or at least decide where it is going to go. It is also important that you decide if you are going to use a NGRX state manager. It is important not to have to refactor the whole project later.


Try to modularize and create reusable components. In any programming language it is very important to reuse the code as much as possible to speed up and not have to change the code every time you need a change. Think about the components so that they are isolated and generic to favor reusability.


Think about using what Angular offers and before doing anything see if there is already a solution within the Angular ecosystem. For example if wou want to make HTTP request, use the solution that comes in Angular (HTTPClient)


Do not download libraries if they are not completely necessary. For example long ago in a project I needed a table component. I was looking at the option of adding a library of table components, but decided to implement my own.

With this you get to know your project perfectly and have total control of what you are doing. If you need a change in a library you have to propose it to its creator and they don't always pay attention to you.


Try to use the principles of Optimistic UI. Optimistic UI is a way of displaying information without waiting for a response from the server. For example, imagine that you are developing a real-time chat app. If every time you send a message you have to wait for a response from the server, the user interface will not be immediate.

One way to resolve this for this example would be to directly paint the message on the screen as if it had been sent correctly. If the response coming from the server is wrong then you show the error. This makes it appear to the user that the application works very fast.


If the application is large, try to take advantage of the potential of typescript in terms of creating interfaces and models for the data, that will avoid problems in the long run. In addition you have at your disposal the types for the variables, which is going to facilitate its debugging a lot.


If you can use some css code precompiler like scss, that will speed up the creation of styles a lot.


Create your own component library. This is something I started using recently. You create a library with the components you want and upload them to a repository. When you have to start a new Angular project, you can always download that library to have components already created.


If you create animations, there are ways to reuse them throughout your application, and you will get the code in one place.


Use the pipes whenever you can, especially in the lists, this will get much increase the speed of revaluation (pure

Discussion (0)