3
我還沒有弄清楚這兩種語法的區別是什麼,謝謝Angular 4中的decorator語法@Input('someValue')和@Input()有什麼區別?
我還沒有弄清楚這兩種語法的區別是什麼,謝謝Angular 4中的decorator語法@Input('someValue')和@Input()有什麼區別?
@Input()
不會有任何別名命名。
例
@Input() student:any[];
<component [student]="...">
@Input('someValue')
將別名作爲someValue中
例
@Input('studentInfo') student:any[];
<component [studentInfo]="...">
使用別名時的說明確保您在HTML模板中使用別名。
除了@Aravind的帖子,這也是@Output
和@ViewChild
指令的情況。
謝謝你兄弟! –
@JustinCastillo快樂tp幫助你 – Aravind