http://www.cnblogs.com/dh-dh/p/5210241.html
1、interface: http://blog.youkuaiyun.com/shi_weihappy/article/details/49506717
当参数为对象时,才使用接口(interface)
2、@input:https://segmentfault.com/a/1190000007890167
官网=》教程=》多个组件位置。官网上面很详细
3、@output:https://segmentfault.com/a/1190000007890167
4.ReactiveFormsModule:响应式表单
http://www.cnblogs.com/yitim/p/angular2-reactive-form.html
5.CommonModule: 有了这个模块 ,才能使用ngif和ngfor
6.MaterialModule:Google推出的全新的设计语言
http://blog.youkuaiyun.com/u014291497/article/details/60468967
7.@NgModule中的exports,用来导出组件,这样别的模块就可以使用这个组件。
http://www.cnblogs.com/shitoupi/p/6618449.html
8.ChangeDetectionStrategy:
http://www.cnblogs.com/czaiz/p/6530820.html
9.
1)解构赋值定义数组:
let [first, second]: [number, number]=[1,2]
2)解构赋值定义对象:
let {a,b}:{a:string,b:number}={a:”foo”,b:1};
或者
type C={a:string,b:number};
let {a,b}:C={a:”foo”,b:1};
//let {a,b=2}:C={a:”foo”,b:1}; //b属性给了默认值
10.最简单判断改用readonly还是const的方法是看要把它作为变量使用还是作为一个属性使用,作为变量使用的话-》使用const,作为属性使用的话-》使用readonly
11.OnDestroy:销毁组件
http://www.cnblogs.com/SLchuck/p/5802308.html
12.ActivatedRoute :激活路由/响应式路由
13.get和set方法:官网=》手册指南=》类;
employee.fullName = “Bob Smith”; 调用了set方法
alert(employee.fullName); 调用了get方法
14.$event:在(click)=”onKey($event)”中,用于获取事件元素中的内容,获取input元素中的值:
export class KeyUpComponent_v1 {
values = '';
onKey(event: any) { // without type info
this.values += event.target.value + ' | ';
}
}
获取其他元素中的值:
export class KeyUpComponent_v1 {
values = '';
onKey(event: KeyboardEvent) { // with type info
this.values += (<HTMLInputElement>event.target).value + ' | ';
}
}
15.enableProdMode: angular2 提供enableProdMode接口能够优化打包出来的代码
https://www.v2ex.com/t/324207
16.类中定义变量或函数:
1.public: 公有属性,内部 外部 派生类 都可以使用
2.private:私有属性, 内部可使用 ,外部和派生类不可使用
3.protected:内部和派生类可使用,外部不可使用
4.readonly:将属性设置为只读的,只读属性必须在声明时或构造函数里被初始化
17.
class Greeter {
greeting: string;
constructor (message: string) {
this.greeting = message;
}
greet () {
return 'Hello,' + this.greeting;
}
}
let greeter: Greeter;
greeter = new Greeter('world');
console.log(greeter.greet());
let greeter: Greeter, 意思是Greeter类的实例的类型是Greeter
18.constructor:每次实例化类的时候,都会执行构造函数。