Question

Checkout the following example (see console errors): http://jsbin.com/yubujiku/1/edit?html,css,output

I'm trying to use the exact same uppercase filter for data-binding from the Custom Filter docs. According to the docs i am not doing anything wrong: http://www.polymer-project.org/docs/polymer/expressions.html#custom-filters

Is there anything i'm missing here? Is this a Polymer bug?

Thanks in advance :)

Was it helpful?

Solution

If you look in the DevTools console, you'll see that you're getting this error: Cannot read property 'toUpperCase' of undefined. To solve it, it looks like you'll need to wrap your filter code in an if block to test for undefined inputs.

upperCaseFilter: function(value) {
  if (value) {
    return value.toUpperCase();
  }
}

Here's the fixed version: http://jsbin.com/yubujiku/2/edit?html,css,output

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top