some aurelia behaviors
npm install fasting-troubadour
Some useful binding behaviors for aurelia.
npm install fasting-troubadour
for requirejs based cli, add to aurelia.json dependencies:
``json`
{
"name": "fasting-troubadour",
"path": "../node_modules/fasting-troubadour/dist",
"main": "index"
}
you can also register it as a plugin in main.ts:
``
aurelia.use
.plugin("fasting-troubadour")
this is optional, it will just register all of the binding behaviors as global resources
trims leading and trailing whitespace
`html
`
Notes
- if you are using aurelia-validation, be sure to place trim after validate
`html
`
formats number inputs after you tab away. Controls the minimum and maximum permitted values; the bound value is expected to be a number.
`html
`
Notes
- numeraljs is the formatting engine
- default format is '0.00'
- you can emit an event to force the displayed value to be formatted
`js`
this.eventAggregator.publish("formatted-number:refresh");
constrains input to only accept numeric characters. Bound value is not expected to be a number (eg a string)
`html
`
constrains input to only accept alphanumeric characters.
`html
`
constraints input to only accept alpha characters or space, apostraphe, or dash
`html
`
Notes
- todo: accept more than english alphanumeric characters
constraints input to only above name characters or numeric characters.
`html
`
constrains input to only the characters matched by the provided regex.
`html
`
Notes
- regex is applied to each character - e.g. regex="[a-z]" will allow the entire input to be "a", "aa", "aaz", etc.
A value converter to format numbers that wraps numeraljs. You've probably seen it in every value converter tutorial you've read.
`html
${ val | numberFormat:'0.0000' }
``