X Tutup
Skip to content

Idea to specify bindings with annotations / decorators on methods rather than in the host configuration #3267

@gionkunz

Description

@gionkunz

Wouldn't it be nicer to have something like this:

@Component({
  selector: 'comp'
})
@View({
  template: ''
})
export default class Comp {
  @Property({expression: '[attr.test]'})
  set testProp(value: string) {}

  @Event({name: 'click', stopPropagation: false})
  onClick(event: MouseEvent) {}
}

Rather than this:

@Component({
  selector: 'comp',
  host: {
    '(click)': 'onClick($event)',
    '[attr.test]': 'testProp'
  }
})
@View({
  template: ''
})
export default class Comp {
  testProp: string;
  onClick(event: MouseEvent) {}
}

I know it's gonna be a bit different than working in a template but don't you think this is much more convenient?

Metadata

Metadata

Assignees

Labels

effort2: daysfeatureLabel used to distinguish feature request from other issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup