Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NgModel support for inputs #44

Merged
merged 1 commit into from
Oct 8, 2019
Merged

NgModel support for inputs #44

merged 1 commit into from
Oct 8, 2019

Conversation

Nexyll
Copy link
Member

@Nexyll Nexyll commented Aug 30, 2019

  • Implement
  • Add demo in Angular
  • Tests Components wrap native so tests are not our part.

@Nexyll Nexyll self-assigned this Aug 30, 2019
@MonsieurMan
Copy link
Contributor

Issue at #35

}

private onInput(ev: Event) {
private onInput = (ev: Event) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring methods as fat arrow functions results in them not using the same memory space as normal ones and is heavier.

Is there any reason it has been changed ?

Also, KeyboardEvent should be used instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the method must send an event from a property in the input component, so it had to remain in its scope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://stenciljs.com/docs/templating-jsx

The solution is to keep a normal function and provide the scope in the render function instead :

onInput={(evt: KeyboardEvent) => this.onInput(evt)}
// or
onInput={this.onInput.bind(this)}

// Given
const page = await newE2EPage({
html: `
<wcs-input />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom elements are not intended to be used as self-closing, browser behavior is UB on this.

Remove wcs-input component, the input is now to
be used by wrapping with a form field
@MonsieurMan MonsieurMan merged commit ad0e599 into develop Oct 8, 2019
@MonsieurMan MonsieurMan deleted the feat/input-events branch October 8, 2019 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants