NOTE: After Angular2 was publisehd, google decide to named AngularJS for Angular1 and Angular for the newest versions. Im following the same convention.

Why, why not?

I was trying to find a good reason to support the idea to migrate an angular1 application to the latest version of the framework.

The common arguments proposed where a bit fussy when you need to ‘sell’ to the business your undertanding about progress.

One of the most common arguments was:

Is hard to find new developers in an old technology

and angular1 is getting old, old in concept or solutions like streams, observers, etc.

But this days I face a problem in one project where I’m working. The problem was simple, the user can fire many requests to get some information changing on variable, this will create request like:

http://server.com/resource/1.json
http://server.com/resource/2.json
...
http://server.com/resource/n.json

The 1, 2, n is the diferent value of the context of the information the user needs.

The user can do the request even before a previous request finish. This creates a queue of requests. Every results is visualized on the same place. The problems with this are a few:

  1. The user it may see some flash on information updates from other responses.
  2. We’re fetching information we don’t need, we should be able to cancel requests.

For those problems it’s possible to work with promesis and when a new request is fired if the previous is not finish it can be resolved as empty. Is cheating, but presents a solution.

Don’t try to solve all with an old technology

AngularJS HTTP module doesnt allow to cancel requests. Event if you use rx-angular to implement observers on AngularJS, rx-angular use rxjs 4.x, this observers use dispose() to cancel a subscription to an observer and that doesn’t cancel the http request.

Angular use Observers by default, and use rxjs 5.x. This version of observers use unsubscribe() to cancel a subscription and the HTTPModule on Angular cancel a previous request if is not finished.

A new reason for update

New technologies do the same or even more for less.

The same solution to cancel -or return empty for unfinished pending requests- is done by the framework in a better and safer way.

Do not choose based on fanaticism

Every day is more common to lisening companies that choose a technologie based on one guy who is a fanatic of some tool or framework. More ofter I’m saying to different people there is not silver bullet when you choose a framework, and this frase is more valid on javascript frameworks.

But we careful not to choose based on one guy, one vision, and one isolated mind. You’ll be traped in that desition for a long time.