Angular (+2) Beta has been released just a few days ago. The most significant announcement with this beta is that the angular team are confident in using Angular (+2) for large scale applications. Following my recent post of 5 steps to prepare your AngularJS code to Angular (+2), I gathered few more steps that you can take to ease migration in the future, or rather apply it now to new code.
Why Should I Consider Angular (+2)
Aside from taking a few steps to prepare the code, Angular (+2) holds a variety of benefits.
Its component based architecture leads to applying software architecture best practices right from the start.
One of the most important benefits of using Angular (+2) is performance (from the blog post). The angular team has put in a lot of effort to boost performance regardless the platform it runs on. The digest and change detection features along with the new template syntax has been optimized wisely enough to make changes apply fast.
Here are 3 more steps to follow in order to prepare you AngularJS code to Angular (+2).
Use ng-change with ng-model
Angular (+2) data binding is by default one-way binding. In order to update a model with new changes, a handler must be defined as such:
If you have the time of diving into Angular (+2) docs, read articles and tutorials and want to try the syntax on your AngularJS code - ng-forward is an excellent choice.
Some of the benefits are code organization and easier migration to Angular (+2). You also get to play with the syntax and experience immediate results.
With Angular (+2) already in beta version, I believe it’s time to move on. I also believe in sticking into standards and best practices with it.
This means that while using Angular (+2) syntax, you should always remember that its syntax should wrap vanilla ecmascript code rather than tiding the code to the framework’s features. You should be thinking how you can implement good and solid code architecture to a component or a service, and then allow to wrap it with any framework of choice. This is a challenging task, however it should benefit to the long term.