-
Notifications
You must be signed in to change notification settings - Fork 13.5k
docs: account for this context #28720
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
Conversation
@@ -341,6 +341,10 @@ export class Datetime implements ComponentInterface { | |||
* dates are selected. Only used if there are 0 or more than 1 | |||
* selected (i.e. unused for exactly 1). By default, the header | |||
* text is set to "numberOfDates days". | |||
* | |||
* Developers who wish to access "this" inside of the function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Developers who wish to access "this" inside of the function | |
* Angular developers who wish to access "this" inside of the function |
Should it specify the framework? My concern is that other framework users might get confused with the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I question if this is the best way to document this tip, for a few reasons:
- It creates a lot of duplicate text, which is annoying to maintain.
- I can see us easily forgetting to add the same tip to any future function props.
- It seems to be Angular-specific -- I was unable to access the right
this
in React (using an arrow function) or Vue (using.bind(this)
). If it does actually apply to React or Vue, but my example is just subtly wrong, that only speaks to the need for example code somewhere.
Maybe we could put it in Development Tips instead? Or a page in the Angular-specific docs if it really is only relevant to Angular? I know that's not as discoverable, but my understanding is that this isn't an Ionic-specific issue, so I'm unsure if we need to give it much priority in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from a component that was missed when updating to the link.
Co-authored-by: Amanda Johnston <[email protected]>
Issue number: N/A
What is the current behavior?
In #28694 there was some confusion around how to access
this
inside of a callback function passed to a property on Ionic components. The root issue was due to how thethis
context is determined with developers being responsible for setting the appropriatethis
context.What is the new behavior?
Does this introduce a breaking change?
Other information
Note: The link in the docs will not work until ionic-team/ionic-docs#3333 is merged.