Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(ngPluralize): fix wrong text content when count is null/undefined #10841

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Jan 22, 2015

When lastCount was evaluated to an non-numeric value (e.g. "other") and
count was evaluated to NaN (e.g. null/undefined), the text content
would be (wrongly) based on the previous template.
This commits makes sure the text content is updated correctly.

In order to customize the message shown upon null/undefined one can
specify a 'NaN' property on the when exression object.

Closes #10836

@gkalpak
Copy link
Member Author

gkalpak commented Jan 22, 2015

With this PR, the warning about no matching when expression is only logged if the new value is not null/undefined. I thought logging even for null/undefined would produce too many (possibly undesirable) warnings.
But I don't feel to strongly about it though.

/ping @lgalfaso (because if I recall correctly you were the one "mentoring" the relevant PRs)

@petebacondarwin
Copy link
Contributor

LGTM

@gkalpak gkalpak force-pushed the ngPluralize-fix-negative-count branch from ad0ebae to 07c8c8a Compare January 23, 2015 08:08
When `lastCount` was evaluated to an non-numeric value (e.g. "other") and
`count` was evaluated to `NaN` (e.g. `null`/`undefined`), the text content
would be (wrongly) based on the previous template.
This commits makes sure the text content is updated correctly.

In order to customize the message shown upon `null`/`undefined` one can
specify a `'NaN'` property on the `when` exression object.

Closes angular#10836
@gkalpak gkalpak force-pushed the ngPluralize-fix-negative-count branch from 07c8c8a to 30f8f05 Compare January 23, 2015 08:10
@gkalpak gkalpak closed this in 3228d3b Jan 24, 2015
@gkalpak gkalpak deleted the ngPluralize-fix-negative-count branch February 19, 2015 08:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ngPluralize example has problem when a value >3 is deleted
3 participants