Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Extends knockout with an ability to create an observables on the fly.

License

Notifications You must be signed in to change notification settings

berhalak/koplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koplus

Create observables on the fly with Knockout

Knockout only allows you to bind to existing observables. With this library you can create observables on the fly, right from your binding expression.

Let's start with some examples. Here we have basic knockout binding for text:

<span data-bind="text: CompanyName"><span>
<script>
    var viewModel = {
        CompanyName : ko.observable('github')
    }
    ko.applyBindings(viewModel);
</script>

Here's an equivalent example using koplus library, but with no explicit observable creation.

<span data-bind="text: +CompanyName"><span>
<script>
    koplus.init();
    var viewModel = {};
    ko.applyBindings(viewModel);
    console.log(ko.isObservable(viewModel.CompanyName)); // prints true
</script>

About

Extends knockout with an ability to create an observables on the fly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published