Skip to content
Maxime LUCE edited this page Feb 25, 2014 · 1 revision

Ensure text length by adding given replacement character.

Samples

Simple text padding
<p data-bind="pad: { text: myNumber, length: 10, char: '#' }"></p>

will result in

<p>#######123</p>
Text padding by right
<p data-bind="pad: { text: myText, length: 10, char: '.', right: true }"></p>

will result in

<p>text......</p>

Options

text
  • type: string
  • required

Text to be limited

length
  • type: number
  • required

Maximum character length

char
  • type: string
  • optional
  • default: 0

Character to append if text length is to few

prefix
  • type: string
  • optional

A custom prefix to apply

right
  • type: boolean
  • optional
  • default: false

Append replacement character to right

Clone this wiki locally