knockout.money

2.0.1 • Public • Published

Knockout Money Extender

A simple knockout extender which wraps accounting.js.

Installation

npm install knockout-money

Then add knockout.money.js to your project.

Usage

require the script in your bundle, then:

var money = ko.observable().extend({ money: true });
money("17000");
 
console.log(money()); //17000
console.log(money.formatted()); //$17,000.00

You can also use it to set formatted money as a value. This is useful for binding user-editable text boxes to the formatted computed.

money.formatted("$17,000.56");
console.log(money()); //17000.56

Dependencies (1)

Dev Dependencies (3)

Package Sidebar

Install

npm i knockout.money

Weekly Downloads

2

Version

2.0.1

License

MIT

Last publish

Collaborators

  • chadly
  • mdarens
  • tullo_x86