Git Product home page Git Product logo

knockoutextras's Introduction

NOTE: Check out the test.html page for a working example

Bindings

numericText - Similar to the text binding, but for a numeric value, to use:

data-bind="numericText: numberValue, precision: 2"

json - Displays the selected value or object in JSON notation. Useful for debugging:

data-bind="json: value"

Bootstrap Bindings

modal - Binds a modal dialog

To use, specify data-bind="modal: boolValue", eg:

<a href="#" class="btn" data-bind="click: showModalToggle">Modal Test</a>

<div class="modal hide fade" data-bind="modal: showModal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>Modal header</h3>
  </div>
  <div class="modal-body">
    <p>One fine body</p>
    <form data-bind="submit:showModalToggle"></form>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn" data-bind="click: showModalToggle">Close</a>
    <a href="#" class="btn btn-primary">Save changes</a>
  </div>
</div>

slider - Binds a slider control

To use, specify data-bind="modal: boolValue", eg:

<input type="text" value="0" data-bind="slider: sliderValue" data-slider-min="0" data-slider-max="10" data-slider-step="1" data-slider-value="0" data-slider-orientation="horizontal" data-slider-selection="after" data-slider-tooltip="hide">

Functions

Arrays

pushAll - pushes an array of items to an observable array without firing a new event for each item.

var myArray = ko.observableArray([]);
myArray.pushAll(additionalValues);

replaceAll - replaces all items in an observable array without firing a new event for each item.

var myArray = ko.observableArray(initialValues);
myArray.replaceAll(newValues);

Extenders

numeric - formats a numeric observable to the specified number of decimal places, eg:

var myValue = ko.observable(1.223123).extend({numeric: 1});

Transitions

fadeVisible - the same as visible, except that it fades the element in and out

<div data-bind="fadeVisible: showFadeText">TEST</div>
<a href="#" class="btn" data-bind="click: fadeToggle">Fade In/Out</a>

knockoutextras's People

Contributors

denwilliams avatar

Stargazers

Jonathan Barratt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.