Skip to content Skip to sidebar Skip to footer

Polymer Use Function Validation On Core-input

Can someone explain me how to use the function validation of this Polymer element (navigate to the 'validate' section? core-input doesn't accept validate="test()" syntax. You would have to install the method directly onto the element, like so:

input.validate = function() { ... }

Where data-binding is supported, you can use the published invalid property:

<core-input invalid="{{inputValue | validate}}" ...

where validate is a method on the model that takes a string and returns a boolean.

For example, in an element:

<template>
  <core-input invalid="{{inputValue | isInvalid}}" ...
</template>
<script>
  Polymer({
    isInvalid: function(value) { return false; }
  });
</script>  

Post a Comment for "Polymer Use Function Validation On Core-input"