You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Currently, passing an undefined limit to the limitTo filter will return an empty array/string.
I would expect filtering to be skipped and the original input returned, when the limit argument is undefined.
E.g.:
Limit: <inputtype="number" ng-model="limit" />
Items: <ul><ling-repeat="item in items | limitTo:limit">...</li></ul>
Before interacting with the input (i.e. explicitly specifying a limit), I would expect all items to be listed.
What happens instead, is that no item is listed, until a valid integer number is specified.
Although there are ways around this limitation (i.e. detecting undefined and set limit to Infinity), they are unnecessrily verbose (imo).
It kind of makes sense what you are saying and I think that the current behavior is bogus for non-string inputs. Having said this it would be a breaking change (see those tests:
Activity
pkozlowski-opensource commentedon Dec 16, 2014
It kind of makes sense what you are saying and I think that the current behavior is bogus for non-string inputs. Having said this it would be a breaking change (see those tests:
angular.js/test/ng/filter/limitToSpec.js
Lines 45 to 51 in 85758ce
pkozlowski-opensource commentedon Dec 16, 2014
Oh, actually it is fine for arrays. But yeh, we can revisit behavior for undefined in 1.4.x
marcin-wosinek commentedon Dec 17, 2014
I'm taking look at this. Should it return input unchanged only for undefined and 'undefined'; or for all bogus values?
feat(limitTo): ignore limit when undefined
feat(limitTo): ignore limit when undefined
feat(limitTo): ignore limit when invalid
feat(limitTo): ignore limit when invalid
feat(limitTo): ignore limit when invalid
feat(limitTo): ignore limit when invalid
feat(limitTo): ignore limit when invalid
feat(limitTo): ignore limit when invalid
feat(limitTo): ignore limit when invalid
marcin-wosinek commentedon Dec 21, 2014
@petebacondarwin I believe this can be closed too due to #10510.