Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.
ozbePublic archive

About

Combine LINQ for Javascript with Knockout.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

ko.linq adds convenience functions to ko.observableArray to easily access linq functions, along with a ToObservableArray() function to convert Enumerable back to a ko.observableArray.

Dependencies

Setup

Simply add a script element referencing the ko.linq javascript file after the knockout and linq script elements of your html.

<script type="text/javascript" src="scripts/knockout.js"></script>
<script type="text/javascript" src="scripts/linq.js"></script>
<script type="text/javascript" src="scripts/ko.linq.js"></script>

Example

http://jsfiddle.net/ozbe/spsLV/

var output = function (value) {
	console.log(value);
};

var array = ko.observableArray([
	{ id: 1, title: 'Catch 22' },
	{ id: 2, title: 'Moby Dick' }
	]);

output('Input: ' + array());

var array2 = array
	.Select(function(x) { return x.title; })
	.ToObservableArray();
  
output('Input: ' + array2());

About

Combine LINQ for Javascript with Knockout.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages