AngularJS and Angular are not that different… – Pranav Jindal – Medium

#AngularJS and #Angular are not that different…  #JavaScript

  • AngularJS and Angular are not that different…Pranav JindalI have been reading a lot of blogs that try to convey the differences between AngularJS and Angular and what I feel after reading all these blogs is that both are not very different.When I say AngularJS, I mean latest Angular 1, may be 1.6 or so.
  • I’m not writing this article with respect to upgrading an app but learning Angular if you are an AngularJS developer.Leaving the syntactical differences of JavaScript and TypeScript (default language for Angular), I wouldn’t say it is a completely new framework.I’ll try to take few points that blogs mark as a major difference:Angular 1.
  • Good that AngularJS(1.5+) included less complicated components api with lifecycle hooks which again are similar to Angular component lifecycle hooks.5.
  • I think this is a positive step towards reducing bugs caused by race conditions when you have third party libraries (that make dynamic script tags to fetch more JS) that your Angular code might be using.What I feel is, if we do a bare-bone comparison, most of the concepts of AngularJS apply in Angular too.
  • No doubt there are differences which makes it quite hard for migrating an AngularJS app but from learning perspective it might not be that difficult.If you are an advocate of best practices of AngularJS, you must be feeling that they have made the new Angular in such a way that best practices are now being enforced by the framework by trimming down the unnecessary, redundant and complicated parts.No doubt there is an initial setup required to start an Angular app but that is all worth as it helps you make a good foundation of the project and not letting you do things haphazardly.

I have been reading a lot of blogs that try to convey the differences between AngularJS and Angular and what I feel after reading all these blogs is that both are not very different. When I say…

@ReactiveConf: #AngularJS and #Angular are not that different… #JavaScript

Pranav Jindal

I have been reading a lot of blogs that try to convey the differences between AngularJS and Angular and what I feel after reading all these blogs is that both are not very different.

When I say AngularJS, I mean latest Angular 1, may be 1.6 or so. I’m not writing this article with respect to upgrading an app but learning Angular if you are an AngularJS developer.

Leaving the syntactical differences of JavaScript and TypeScript (default language for Angular), I wouldn’t say it is a completely new framework.

I’ll try to take few points that blogs mark as a major difference:

Even though Angular doesn’t have controller or $scope, but we still have to make a class that eventually controls the component. Also, instead of $scope, we have to use this keyword, which is quite in sync with the controllerAs syntax of AngularJS. The controllerAs syntax internally treats the controller as a constructor function (or I’d say class in ES6).

2. Syntactical changes for directives

I don’t care if ng-repeat is written is ngFor now. If it works, it is good enough. Syntactical changes are matter of few days and you are good to go. Same goes for any other directive.

3. Event directives like ng-click are gone

I’d say that is a fantastic upgrade. No more need of using a directive when you can attach a function from your code directly to an HTML event you have always known. Again the parenthesis syntax doesn’t matter.. it’s just syntax.

4. Only components in Angular

I think if you have been a good AngularJS developer who has followed best practices, this is not even a change for you. I’ve always been inclined towards the components based approach (directives with isolated scope) even when there were no components in Angular. Good that AngularJS(1.5+) included less complicated components api with lifecycle hooks which again are similar to Angular component lifecycle hooks.

5. No ng-app or automatic bootstrapping of Angular

In my opinion autobootstrap of AngularJS was included to brag about how easy is to start using AngularJS without writing a line of JS code but I think that’s not the point of using a full fledged JS framework. If you are using something like AngularJS, you don’t think of not writing JS. I think this is a positive step towards reducing bugs caused by race conditions when you have third party libraries (that make dynamic script tags to fetch more JS) that your Angular code might be using.

What I feel is, if we do a bare-bone comparison, most of the concepts of AngularJS apply in Angular too. No doubt there are differences which makes it quite hard for migrating an AngularJS app but from learning perspective it might not be that difficult.

If you are an advocate of best practices of AngularJS, you must be feeling that they have made the new Angular in such a way that best practices are now being enforced by the framework by trimming down the unnecessary, redundant and complicated parts.

No doubt there is an initial setup required to start an Angular app but that is all worth as it helps you make a good foundation of the project and not letting you do things haphazardly. After all Angular is a Web Apps framework, not a prototyping framework.

Have a great day!!

AngularJS and Angular are not that different… – Pranav Jindal – Medium

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.