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

Cannot bind attributes (@Input) for @Directive #84

Closed eesdil closed 8 years ago

eesdil commented 8 years ago

Is it possible to add extra attributes to @Directive? As it doesnt seem to add the @Input() decorator... It is working fine with @Component.

timkindberg commented 8 years ago

You'd have to access other attrs with $attrs, which you can inject into the constructor

@Directive()
@Inject('$attrs')
class MyDirective {
  constructor($attrs) {
    console.log($attrs.someOtherAttr)
  }
}