Search code examples
polymerpolymer-2.0

is there any way to set char-counter maxlength dynamically for paper-input


I want to set different maxlength for different data, i tried by writing a method in maxlength but it didn't worked, so is there any other possibility

<paper-input label="{{data.name}}" id="input" char-counter maxlength="getMaxLength()"></paper-input>

Solution

  • use a property and set max length to property:

       <paper-input label="{{data.name}}" id="input" char-counter maxlength="[[maxValue]]"></paper-input>
    

    use a method and return value from method:

       <paper-input label="{{data.name}}" id="input" char-counter maxlength="[[getMaxLength()]]"></paper-input>