When SHOULD You Use Angular 2?





0/5 (0 vote)
When should you use Angular 2?
People continue to ask – “Should I use Angular 2 for my new project?”
What if the project doesn’t need to be ready for a few months?
What if it’s a small side project, or a proof-of-concept?
Maybe you’ve already been playing around with Angular 2 at home, but you’re stuck with 1.x at work.
At some point, it goes from “should I?” to “why can’t I?” – you want to play with the new toys! Clean component architecture, faster performance, and all the goodies that come with ES6 or TypeScript? Awesome!
How To Decide
Follow this handy flow chart:
Essentially, if this is a low-risk project (failing it won’t mean the failure of your business or something), and you’re prepared to spend some time figuring things out on your own, give Angular 2 a shot.
Just beware that it’s still alpha software, and could change massively, breaking everything you wrote. There won’t be as much help available on Stack Overflow as you’re used to with Angular 1.
To be perfectly clear, I’m not saying Angular 2 is “ready for prime time” here. You still need to weigh the risks and exercise your best judgement. Check out Is Angular 2 Ready? to see the progress toward beta.
Using Angular 2
If you’ve decided to take the plunge, but haven’t played with it at all yet, you’ll want to decide which language to use: ES6, TypeScript, or even plain old ES5. Moreover, now is a good time to sign up for my newsletter! Stay ahead of the curve with articles about Angular 2 and best-practices Angular 1 development.
Articles about Angular 2 and Best-practices Angular 1?
After you sign up for my newsletter, make sure you’ve got some good tutorials under your belt and dive in.
Using Angular 1
Sticking with Angular 1 for now? No shame.
There are a few things you can do to make your app easier to migrate to Angular 2 if you decide to later on:
- Start writing in ES6 or TypeScript
- Use
controllerAs
syntax everywhere you can. Reduce dependencies on $scope. - Make your app into a tree of components (one directive = one component)
- When Angular 1.5 is ready, start using its new .component syntax instead of .directive
- Until Angular 1.5, structure your directives like this:
{ restrict: 'E', scope: { ... }, // isolate scope controller: 'NameCtrl', controllerAs: 'name', bindToController: true, // no link // no compile }
- Avoid
ng-controller
- Check out RxJS observables as a way of wrapping $watch
When SHOULD You Use Angular 2? was originally published by Dave Ceddia at Angularity on November 14, 2015.