Questions tagged [knockout-es5-plugin]

Knockout-ES5 is a plugin for Knockout.js that lets us use simpler and more natural syntax in model code and bindings.

Knockout-ES5 is a plugin for Knockout.js that lets us use simpler and more natural syntax in model code and bindings.

http://blog.stevensanderson.com/2013/05/20/knockout-es5-a-plugin-to-simplify-your-syntax/

16 questions
7
votes
3 answers

Revealing module pattern with Knockout-es5

I am trying to put together a demo to use knockout-es5 plugin to simplifying the models that are using revealing module pattern. ViewModel1 is original Knockout model and it works fine. ViewModel2 is an attempt to use knockout-es5 plugin. Running…
amit_g
  • 30,880
  • 8
  • 61
  • 118
6
votes
1 answer

Knockout binding value.update not being called with custom binding and defineProperty

I have a Knockout extension, knockout-secure-binding, and we have encountered an issue. In particular when using Object.defineProperty, as knockout-es5 does, the value binding's update function is not called when a change event is triggered on an…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
6
votes
1 answer

Sub-observables with Knockout ES5

Ryan N uses a technique he calls "sub-observables" in a couple posts, where he hangs observables off of "parent" observables. It looks like this: var parent = ko.observable("I'm the parent"); parent.sub = ko.observable("I'm the child"); parent() …
Kyeotic
  • 19,697
  • 10
  • 71
  • 128
4
votes
1 answer

Two way custom binding with knockut 3 and es5 plugin

In my custom binding, I cannot write data back to model. The problem is that there is no way to write into "writable" property. In knockout 2 there was possibility to use allBindingsAccessor()._ko_property_writers But in version 3 there are no such…
user133408
4
votes
5 answers

How to access the observables in custom bindings when using Knockout-ES5

If the model properties are ko.observable(), these can be accessed as below within the custom binding. var observable = valueAccessor(); When using Knockout-ES5 plugin how to get hold of the observable within the custom binding? Check the code…
amit_g
  • 30,880
  • 8
  • 61
  • 118
3
votes
1 answer

UI not updating when a model property is updated which is tracked by knockout ES5

I have a model which looks like below: vm.testModel= { testProperty:[] } Before the page loads, the model is tracked using ko.track(vm.testModel) method. At run time on click of a button, I add few properties to this model as…
user2585299
  • 873
  • 2
  • 19
  • 41
3
votes
1 answer

knockout-es5 boolean setter does not work properly

I'm trying to use a negated boolean setter with knockout-es5, however changes using the toggleViewModel function are not picked up in the view. When I use self.showViewModelData(!self.showViewModelData()) it does work as expected. In the debugger I…
Tom
  • 213
  • 1
  • 8
2
votes
1 answer

Knockout es5 typings

I am attempting to update my knockout typings, as latest version of typescript is is detecting problems with the older ones. The problem comes with trying to get the knockout and knockout.es5 typings working together. I am using VS2017 and a…
2
votes
1 answer

Cannot write to an observable received as param inside of knockoutjs component

KO components receives a reference of observable when we passes it as params. As componentes receives it as a reference you can write to this observable and it will reflect on your viewmodel; But, when you using ko-es5 plugin (super awesome) your KO…
2
votes
1 answer

Require JS with Knockout components is looking for js file in incorrect path

I am trying to understand how require js works by building knockout components.I have built 2 separate knockout components for testing. My directory structure is as follows: - App |_ Components |_ Like-Widget |_like-widget.js …
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47
2
votes
2 answers

deleting items from an array with knockoutjs es5

Fiddle I'm trying to use knockout.js with the ES5 plugin, but I'm not able to get deleting from an array to work. It seems to work somewhat, you can delete, but there is always one item left in the array, but not really somehow. I'm totally…
Nateous
  • 757
  • 9
  • 23
2
votes
3 answers

Knockout binding handler pass array of objects

Is it possible to pass array value with square brackets for binding handler?, ie:
It works fine for one object:
PeterM
  • 1,478
  • 1
  • 22
  • 28
2
votes
4 answers

How to pass a property by reference

Is there a way to pass an object property to a function by reference instead of by value? ES5 properties can have getters and setters. How to pass a variable that uses the getters and setters instead of the result of the getter? Right now I have…
Manuel
  • 10,869
  • 14
  • 55
  • 86
2
votes
0 answers

Track model's array properties using knockout ES5

I have a model object in which few properties are arrays as seen below: var Object1 = { Prop1 = []; Prop2 = null; }; ko.track(Object1) will not track the array property Prop1. How can this array property be tracked? Currently I am doing as…
user2585299
  • 873
  • 2
  • 19
  • 41
1
vote
2 answers

How can I get knockout to update a defined property?

Consider this typescript class (but I don't think Typescript is relevant to the problem, other than obscuring the underlying defineProperty call): class Model { public TeamId: number; constructor() { var self = this; …
Joshua Frank
  • 13,120
  • 11
  • 46
  • 95
1
2