Why Angular2 is Easier Than AngularJS
Even if you have been hiding under a rock, you must know that Angular2 is coming (or is already here, depending on who you speak to!). That said, a lot of people have been up in arms at the drastic changes that Angular2 is proposing over AngularJS , to the extent that at first sight, they might look like two completely different frameworks. But when you actually spend some time digging into it, you would come to realize that Angular2 actually
- Is using the same concepts that AngularJS proposed and implemented
- Simplifies a great deal of things to make it easier to develop in AngularJS
In this write-up, we will go over some of the major reasons why Angular 2 is actually
Goodbye 40+ directives, it was nice knowing you!
Remember when you first started learning Angular 2, you suddenly had to learn all these special directives, from ng-click to ng-show to ng-class, and whatnot. Every action that we wanted to achieve would translate to a directive, and if we wanted to support a new behavior, it would mean writing or integrating with a new directive. This was necessary because AngularJS 1 was a wrapper around jQuery and DOM, and thus needed an outlet for each API.
Not so with Angular 2. Most DOM elements are directly bindable, with the new Data & Event binding syntax. That means we can directly bind values to styles, innerHTML, as well as bind to native events such as click, mouseover, etc. No need for new libraries, new integrations.
We can now say goodbye to
- ng-show / ng-hide
And many more directives. Life is a lot simpler in Angular 2!
No more Services, Factories, Providers, Directive Definition Objects
Originally published at www.laravelfeed.com.