Skip to content

Plugin for Knockout JS library which allows to use few view models for single view.

Notifications You must be signed in to change notification settings

azr/Knockout-MultiModels

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Knockout-MultiModels

Plugin for Knockout JS library which allows to use few view models for single view.

Usage

Just use ko.attach("", viewModel) and ko.detach("") methods instead of ko.applyBindings().

To assign HTML element with view model use data-model attribute with name of view model.

Attaching view model

var model = { Text: ko.observable("Some text") };
ko.attach("FirstModel", model);

Detaching view model

ko.detach("FirstModel");

HTML

<div data-model="FirstModel">
	<p data-bind="text: Text"></p>
</div>

Dependencies

  • Jquery 1.7.1+
  • Livequery 1.1.1+
  • Knockout JS 2.1.0+

Live demo

Please, use examples/knockout.multimodels.htm to see live demo.

Links:

License: MIT http://www.opensource.org/licenses/mit-license.php

About

Plugin for Knockout JS library which allows to use few view models for single view.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.2%
  • CSS 6.8%