The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Add Inputs to Angular Directives

Add Inputs to Angular Directives

2:55
The `@Input` decorator allows you to pass values into your `@Directive` so that you can change the value of the Directive each time that it is used. Using `@Input` makes your Directives much more flexible and reusable so they can adapt to many different situations.
Watch this lesson now
Avatar
egghead.io

The @Input decorator allows you to pass values into your @Directive so that you can change the value of the Directive each time that it is used. Using @Input makes your Directives much more flexible and reusable so they can adapt to many different situations.

Avatar
Hero

:) Clarification request :)
With respect to the FirstDirective in the video. Is the usage of "@Input first" with the " selector: '[first]' " a special case when you want to "enable"/use property binding with a directive? Meaning, anytime we want to use property binding our custom directive we have to, by default make the directive's selector use brackets "[selector-name]" notation because ng2 template property binding syntax needs bracket notation and we need to make our custom directive's "@Input" match its "selector-name" between the brackets? In summary, is it correct to say that; when we want to use property binding on our custom directive, we have to make our custom directive conform to the ng2 template property binding syntax requirements?

Thanks for these great videos btw :). They are very helpful.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?