api-console-assets
Version:
This repo only exists to publish api console components to npm
44 lines (41 loc) • 894 B
HTML
<!--
@license
Copyright 2017 Mulesoft.
All rights reserved.
-->
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../iron-validator-behavior/iron-validator-behavior.html">
<script>
Polymer({
is: 'minimum-maximum-length',
behaviors: [
Polymer.IronValidatorBehavior
],
properties: {
// Error message to display
message: {
type: String,
value: 'Value too short or too long'
},
// Min value for the string value.
min: {
type: Number,
value: 4
},
// Max value for the string value.
max: {
type: Number,
value: 12
}
},
validate: function(value) {
if (!value) {
return false;
}
if (value.length < this.min || value.length > this.max) {
return false;
}
return true;
}
});
</script>