Text data-bind expressions can have only a single property. How would I pluralize some text depending on the count of another property?
Text data-bind expressions can have only a single property. How would I pluralize some
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are several ways to do this. I demonstrated 2 ways in the fiddles shown here: http://jsfiddle.net/njj2P/2/
The first option I showed is to use a ko.computed to determine if the name should be returned in singular or plural form, based on an evaluation.
The second option shows how to do this without a computed property, and instead by using a conditional binding.