ngUpgraders / ng-forward

The default solution for those that want to write Angular 2.x style code in Angular 1.x
411 stars 36 forks source link

inputs and outputs for @Directive decorator #140

Open friedolinfoerder opened 8 years ago

friedolinfoerder commented 8 years ago

Inputs and Outputs are working with the @Component decorator but not with the @Directive decorator.

It would be nice to use the component features with the directive decorator so that you can use additional data (which is also databounded) in your directive controller and view.

Working only with the $attrs object - as stated here: #84 - is not the same. So adding inputs and outputs would be great.

timkindberg commented 8 years ago

Do @Input and @Output actually work with @Directive in angular 2?

friedolinfoerder commented 8 years ago

Yes, they do. In the first example of the official angular2 @Directive docs page there is a demonstration of how to use inputs. (https://angular.io/docs/ts/latest/api/core/Directive-decorator.html)

An example of how to use the outputs field is described on the DirectiveMetadata page: https://angular.io/docs/ts/latest/api/core/DirectiveMetadata-class.html