When Angular first started it was a significant improvement over existing frameworks. We no longer had to set every single attribute or trigger an event for any change in the UI. It was pure magic, just add your binding to the view and that was it. I, as so many others, was really excited about it. It was a lot better than some other frameworks at the time. Now, after a year of working with an enterprise level Angular app, I feel not everything in Angular is magic. That being said, great apps can be built with Angular.
These are some of the lessons that were incorporated as our application grew larger:
We have to be mindful with added latency for each of the resolves used. If we pile multiple resolves for a single route, we create a synchronous operation that will block the application. Meaning that nothing else in the Angular app will execute while the resolves are getting data. We also noticed that while the resolves were getting fetch, the router would not even register correctly the events for browser back and forth.
A better approach is to load resources on the screen asynchronously as soon as they are ready. This will give the user the impression that the app is loading faster.
As our application grew, we noticed some decline in performance, specially on Windows machines. On our Mac machines, we never noticed any issues on the browsers, but as more users started playing around with the application, the issues became evident. It got so bad that on some machines, after 30 minutes of continuous use, the application was crashing.
Always use track by:
<div ng-repeat="a in arr track by a.trackingKey">
<div ng-repeat="a in arr">
By adding track by, the rendering of the repeated elements is more efficient. This will tell Angular to only render elements needed rather than to have to recalculate and re-render all the elements in the list.
We also remove any function call to parse or process data inside the ng-repeat. Rather than parsing data in the template we always parse data prior to binding it.
As any developing process, we are constantly learning new techniques, new practices. Always look for the experience provided by the great Angular community. Angular is a mature framework with a great online community. And while there are great options like React.js and others, Angular is not going away anytime soon.