knockout.js - Observing Properties of a User Defined Javascript Object -
I know that we can not see the properties of an object just by looking at an object. But I want to know that my understanding is correct.
Can we do something like that?
function person (name, age) {this.name = name; This.age = age; } $ (Function () {var vm = (function () {var person = ko.observable (new person ("ABC", 23)); Return {person: person};}) (); ko.applyBindings (vm );}); This is not working so we can not guess. I do not even know where this character comes from 'C'.
You are not far away, when you refer to it in your markup, your person Observation must be opened: & lt; Input data-bind = "value: person () .name" /> & Lt; Input Data-Bind = "Value: Person (). Age" /> Edit from a comment
You can see the properties of person So that they can track such changes: function person (name, age) {this.name = ko.observable (name); This.age = ko.observable (age); }
Comments
Post a Comment