What happend about Angular2.0

前几天听到朋友说,可以不用看angular了,angular2.0的改动是颠覆性的,出于好奇看了angular2.0的视频介绍。

Angular 2.0 Core
Angular 2.0 Core by Igor Minar & Tobias Bosch

首先我们来看看Angular1和Angular2在语法上的区别:

AngularJS-1.3 AngularJS-2.0

可以看到原来的ng-controller、ng-model、ng-click等关键词都替换成了使用括号的属性。右边则是表达式。视频里讲到了Properties & Attributes的区别,之前我一直分不清这两这到底有什么区别,现在算是明白了,引用原话解释:

All elements have properties and some properties are serializable into attributes and those that are always restricted(受限制的) to using just a string type.
So we find properties to be more flexible because they have different types and usually the API surface is bigger.

为什么说angular的改变是颠覆性的,来看看下面几张图,相信看完后你会吐血

controllers killed Continue reading →