-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Pagination. Call pageChange to many times on Init #898
Comments
No idea without a minimal reproduce scenario: https://github.com/ng-bootstrap/ng-bootstrap/blob/master/README.md#you-think-youve-found-a-bug |
Once this code here affects, it is not clear ...
In the service:
что здесь может быть не так ума не приложу... ( |
working plunker |
When I come back to the version "@ng-bootstrap/ng-bootstrap": "=1.0.0-alpha.7", problem is disappeared. |
ng-bootstrap/src/pagination/pagination.ts Line 139 in 84d555c
|
My guess is what is happening is that Given that, I don't think this is an issue with the library, unless we want to guard against this situation and default to |
Yup, this wouldn't hurt. |
Actually, @kolkov is right - with 84d555c we are calling @maxokorokov could you take a look at this one as it is regression introduced by 84d555c? I also agree with @kolkov that invoking |
Actually we were emitting multiple times only because current page was The real issue for me is that |
I'm not sure throwing is the best option here as it will break all the people that initialize data asynchronously from the server-side... Maybe we should just assume that there are 0 pages if one of the inputs is invalid? It doesn't sound great either, but yeh, we need to make sure that we support async usage scenarios... |
I don't see the how it is related to async usage scenarios at all. I mean you can do whatever you want if you initialize your collection with an empty one, or your collection size with 0, right? It's about guarding against incorrect inputs:
For me the second way seems clearer; But I don't have a really strong opinion on this one - it's just have to be consistent across components. |
In my specific case I resolved giving a default value to my page property (this.page = 1). It was undefined and now its 1, this way I prevent the automatic change from undefined to 1 and the resulting multiple call of the event (pageChange). |
1.0.0-alpha.8
![image](https://cloud.githubusercontent.com/assets/3740898/19439507/02324dfc-9487-11e6-9c46-f3cda5252a2c.png)
why pageChange calls to much at view init with NAN as event?
What could be the problem?
The text was updated successfully, but these errors were encountered: