I've been avoiding even thinking about the latest rev of Angular as every time I did look at it, I came away with a headache. It was weird and the docs were even weirder. I saw plenty of blog posts on the topic, but in general they dealt with one small slice of Angular 2 and were too confusing for me to grok.
Over the holidays, I checked out the web site again (Angular 2 can be found at https://angular.io/ whereas Angular 1 is still at the old site: https://angularjs.org/). I tried the five minute quick start and while it took me a bit more than five minutes, it made a bit of sense. It certainly wasn't crystal clear to me, but it wasn't crazy either.
I then went through the tutorials and things began to make even more sense. I'm far from being even close to being able to build a demo with it, but the basics are beginning to click for me.
There were three things in particular I ran into that caused me grief.
-
Working with Angular 2 means working with TypeScript. I like TypeScript. But I'm kinda disappointed that working with Angular now means working with a build system to get it into the browser. To be absolutely clear, I'm not saying this is bad. I'm just saying I feel a bit disappointed that this is required now. I'll get over it.
-
The @Component stuff was terribly confusing to me until it finally sank in that those blocks are providing metadata to the classes. It seems so obvious now, but I just couldn't understand what in the heck stuff like this was doing:
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: 'My First Angular 2 App
'
})
export class AppComponent { }
- One thing I really didn't like in Angular 2 was all the different types of "syntax sugar" being used in templates. Here are just a few examples:
[(ngModel)]="foo.name"
and*ngFor
and(click)="something"
. I figured there was no way in heck I'd be able to get that right. Luckily - there's a great cheat sheet that nicely documents all this and is easy to use.
So what's next? I plan on making my way - slowly - through the rest of the docs. I'm also going to reread the tutorials a few times. I then need to make the time to look at Ionic 2.
For a while now I've been telling people that - at least in my opinion - it was too early to start playing with Angular 2. Now I definitely feel like it would be a great time to start playing with it and - possibly - even building real apps with it. I'd love to know what my readers think so leave a comment below. Are you using Angular 2 yet or have you been holding off?