开始学习angular2了,内心还是有点小激动的,看到angular2的文档以及教程后,那份欣喜更重了。
首先选择javascript模式而不是typescript模式(我不会)然后就按照教程上面的配置npm依赖包了,安装之后跳过typescript,复制粘贴app.component.js,boot.js,index.html文件.然后配置nginx静态文件,马上效果就出来了,论文档的重要性!
好了到此开始了解app.core.Component是什么东东了,打开api review -》查找Component , 文档就出来了,在我看来它的文档比react好多了,起码react到死也不会给个例子出来,忘不了那段痛苦的学习经历,但是react学起来还是挺简单的。 下面开始复制粘贴:
constructor({selector, inputs, outputs, properties, events, host, exportAs, moduleId, bindings,
providers, viewBindings, viewProviders,
changeDetection = ChangeDetectionStrategy.Default, queries, templateUrl, template,
styleUrls, styles, directives, pipes, encapsulation}?: {
selector?: string,
inputs?: string[],
outputs?: string[],
properties?: string[],
events?: string[],
host?: {[key: string]: string},
/** @deprecated */ bindings?: any[],
providers?: any[],
exportAs?: string,
moduleId?: string,
/** @deprecated */ viewBindings?: any[],
viewProviders?: any[],
queries?: {[key: string]: any},
changeDetection?: ChangeDetectionStrategy,
templateUrl?: string, //模板url
template?: string, //模板
styleUrls?: string[], //样式url
styles?: string[], //样式
directives?: Array<Type | any[]>,
pipes?: Array<Type | any[]>,
encapsulation?: ViewEncapsulation
})