-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
{{did-insert}}
, {{did-update}}
and {{will-destroy}}
API docs
#8
Conversation
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.
Lookin' good! I think we should also mention that the function is not bound to the template context by default, and show how the user might do that (e.g. via action
or using ember-bind-helper
).
Also, I'm happy to land PR's like this iteratively... |
d27b454
to
afbad69
Compare
I've added a short section on using |
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 think the "simplest" demo would be some sort of "refs" type thing:
<div {{did-insert (action this.setupSpecialSauceElement)}} class="special-sauce"></div>
Then using the element and this
in that method (perhaps to setup some external DOM plugin e.g. tinymce, mobiledoc, etc).
Thanks, I tried to keep it as simple as possible so I added the following example: By default, the executed function will be unbound. If you would like to access the component context in your function, use the <div {{did-insert (action this.incrementCount)}}>first</div>
<div {{did-insert (action this.incrementCount)}}>second</div>
<p>{{this.count}} elements were rendered</p> export default Component.extend({
@tracked count = 0;
incrementCount() {
this.count++;
}
}); |
{{did-insert}}
API docs{{did-insert}}
, {{did-update}}
and {{will-destroy}}
API docs
I've added docs for |
Thank you! |
part of #2