Questions tagged [knockout.js]
Knockout.js is an open source JavaScript library for dynamic HTML UIs using the Model-View-View Model (MVVM) pattern.
knockout.js
20,501
questions
259
votes
4
answers
121k
views
Can you call ko.applyBindings to bind a partial view?
I'm using KnockoutJS and have a main view and view model. I want a dialog (the jQuery UI one) to popup with another view which a separate child view model to be bound to.
The HTML for the dialog ...
248
votes
1
answer
55k
views
What are the key differences between Meteor, Ember.js and Backbone.js? [closed]
Learning Ember.js / Backbone.js has been on my to-do list for a while. Now that Meteor is out, I am just wondering if anyone with experience of Meteor, Ember.js and Backbone.js can summarize the key ...
229
votes
3
answers
105k
views
Getting "The JSON request was too large to be deserialized"
I'm getting this Error:
The JSON request was too large to be deserialized.
Here's a scenario where this occurs. I have a class of country which hold a list of shipping ports of that country
...
204
votes
14
answers
74k
views
How to debug template binding errors for KnockoutJS?
I keep having trouble with debugging problems in KnockoutJS templates.
Say I want to bind to a property called "items" but in the template I make a typo and bind to the (non existing) property "item"....
204
votes
5
answers
87k
views
KnockOutJS - Multiple ViewModels in a single View
I'm thinking that my application is getting quite large now, too large to handle each View with a single ViewModel.
So I'm wondering how difficult it would be to create multiple ViewModels and load ...
197
votes
2
answers
44k
views
Difference between knockout View Models declared as object literals vs functions
In knockout js I see View Models declared as either:
var viewModel = {
firstname: ko.observable("Bob")
};
ko.applyBindings(viewModel );
or:
var viewModel = function() {
this.firstname= ko....
192
votes
4
answers
80k
views
How can I get Knockout JS to data-bind on keypress instead of lost-focus?
This example of knockout js works so when you edit a field and press TAB, the viewmodel data and hence the text below the fields is updated.
How can I change this code so that the viewmodel data is ...
187
votes
8
answers
172k
views
Javascript Equivalent to C# LINQ Select
Following this question here :
Using the checked binding in knockout with a list of checkboxes checks all the checkboxes
I've created some checkboxes using knockout that allow selection from an ...
167
votes
8
answers
74k
views
Is it possible to data-bind visible to the negation ("!") of a boolean ViewModel property?
I'd like to use a property on my ViewModel to toggle which icon to display without creating a separate computed property of the inverse. Is this possible?
<tbody data-bind="foreach: periods">
...
156
votes
4
answers
139k
views
How to force a view refresh without having it trigger automatically from an observable?
Note: this is mostly for debugging and understanding KnockoutJS.
Is there a way to explicitly request Knockout to refresh the view from (already bound) view model? I am looking for something like:
...
140
votes
6
answers
53k
views
TypeScript with KnockoutJS
Is there any sample of using TypeScript with KnockoutJS? I'm just curious as to how they would work together?
Edit
Here is what I have, seems to work
declare var ko: any;
declare var $: any;
class ...
135
votes
13
answers
72k
views
jQuery UI datepicker change event not caught by KnockoutJS
I'm trying to use KnockoutJS with jQuery UI. I have an input element with a datepicker attached. I'm currently running knockout.debug.1.2.1.js and it seems that the change event is never being caught ...
131
votes
3
answers
91k
views
How to use knockout.js with ASP.NET MVC ViewModels?
Bounty
It's been awhile and I still have a couple outstanding questions. I hope by adding a bounty maybe these questions will get answered.
How do you use html helpers with knockout.js
Why was ...
116
votes
10
answers
119k
views
How to clear/remove observable bindings in Knockout.js?
I'm building functionality onto a webpage which the user can perform multiple times. Through the user's action, an object/model is created and applied to HTML using ko.applyBindings().
The data-bound ...
116
votes
2
answers
72k
views
When to use ko.utils.unwrapObservable?
I've written a few custom bindings using KnockoutJS. I'm still unsure when to use ko.utils.unwrapObservable(item) Looking at the code, that call basically checks to see if item is an observable. If it ...