I have just started to dabble in the whole child and parent component communication side of things in Angular 4 and I have noticed some older videos use the syntax input: [] rather than the more commonly seen @Input() syntax, is there any difference between the two? And if not, is there a preference?
-
Weird, ive never seen that. You have any links/examples?diopside– diopside2018-05-02 14:56:00 +00:00Commented May 2, 2018 at 14:56
-
1@diopside I think I mis-understood the usage, all is clear to me now!user9623870– user96238702018-05-02 14:58:55 +00:00Commented May 2, 2018 at 14:58
Add a comment
|
2 Answers
They mean two different things:
@Input()decorator that specifies that a certain property is passed to the current component from the parent component (I.e.@Input() highlightColor: string) - Docsinput: []component property namedinputand of typeArray- Docs
Notice that @Input() input: [] is perfectly valid syntax.