-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
chore(pagination): pageChanged triggered multiple times #138
Comments
Hi, Thanks, |
Agreed! +1 Thanks very much! |
valorkin
changed the title
ng2-bootstrap pagination pageChanged triggered multiple times
chore(pagination): pageChanged triggered multiple times
Feb 6, 2016
valorkin
pushed a commit
that referenced
this issue
Feb 6, 2016
valorkin
pushed a commit
that referenced
this issue
Feb 6, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi all,
I open this issue following a question on StackOverflow. See http://stackoverflow.com/questions/35081261/ng2-bootstrap-pagination-pagechanged-triggered-multiple-times/.
We saw that the
pageChanged
event is fired three times at the initialization of thepagination
component. We expected to have only one.After investigating a bit, it's linked to the use of a TypeScript setter for the
page
property with a custom event. Because Angular2 fires events asynchronously (see this issue: angular/angular#6311), setting values to thepage
property fires event after the component initializationWe saw an
inited
property but it doesn't seem to be useful in this context...We wonder if it's a normal behavior or a bug.
Here are some proposals to only have one events fired at the component startup:
(file
node_modules/ng2-bootstrap/components/pagination/pagination.ts
):Update the
set page
block to trigger events only when theinited
property istrue
:Update the
ngOnInit
method not to set theinited
property to true at its end:Set the
inited
property to true at the end of the first call of thewriteValue
:Thanks very much for your feedback!
Thierry
The text was updated successfully, but these errors were encountered: