Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 4中的decorator语法@Input(';someValue';)和@Input()之间有什么区别?_Angular_Typescript_Decorator - Fatal编程技术网

Angular 4中的decorator语法@Input(';someValue';)和@Input()之间有什么区别?

Angular 4中的decorator语法@Input(';someValue';)和@Input()之间有什么区别?,angular,typescript,decorator,Angular,Typescript,Decorator,我还不清楚这两种语法之间的区别是什么,请提前感谢@Input()将不会有任何别名命名 范例 @Input() student:any[]; <component [student]="..."> @Input('studentInfo') student:any[]; <component [studentInfo]="..."> 说明使用别名时,请确保在HTML模板中使用别名。除了@Aravind post之外,@Output和@ViewChild指令也

我还不清楚这两种语法之间的区别是什么,请提前感谢

@Input()
将不会有任何别名命名

  • 范例

     @Input() student:any[];
     <component [student]="...">
    
    @Input('studentInfo') student:any[];
    
    <component [studentInfo]="...">
    

说明使用别名时,请确保在HTML模板中使用别名。

除了@Aravind post之外,
@Output
@ViewChild
指令也是如此。

@JustinCastillo>帮助您