開始學習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
})