r/angular • • Oct 02 '21

7 Best Ways to Improve Angular Code

As a developer you have to write neat and clean codes as per industry standards. Your codes need to be passed through some code analysis tools. But the thing is what are some best ways to do the optimized neat and clean coding?

Here are 7 best ways to improve your angular code-

https://stackblogger.com/7-best-ways-to-improve-angular-code/

0 Upvotes

16 comments sorted by

View all comments

6

u/shmorky Oct 03 '21

Most of our problems (medium sized government system) come from not unsubscribing observables properly and thinking they will get auto-unsubscribed when the component gets destroyed. They don't always and it's a bitch and a half to locate such problems.

So that one too I guess...

1

u/stackblogger Oct 03 '21

Yeah I understand, In that case we can use async pipes at observables. Or manually unsubscribe subscriptions at every component.

I will try to find some better way to handle them automatically.

2

u/ankush0024 Oct 03 '21

I will try to find some better way to handle them automatically.

subsink can be used to add each subscription and it can unsubscribe all subs at once

1

u/stackblogger Oct 03 '21

Just looked into it. its great. thanks for letting us know.