dineshd87
dineshd87

Reputation: 139

Knockout js: Viewmodel property not being bound

This is my fiddle. http://jsfiddle.net/aaScC/

Please check in the example, the Score property has 3.5 value but it is being displayed as 1. I know the score property is bound to dropdown value so its coming as 1. But i want 3.5 to be displayed. Please help.

var GoalsModel = function (goals) {
    var self = this;

    self.goals = ko.observableArray(ko.utils.arrayMap(goals, function (goal) { return new Goal(goal) }));


};

Upvotes: 0

Views: 45

Answers (1)

waxwing
waxwing

Reputation: 18743

The problem is that you just make the select element invisible. You don't want the element at all. You can use bindings if or ifnot to control this.

Here is an updated example: http://jsfiddle.net/waxwing/aaScC/1/ . I wrapped the select inside a span to make it work, but you can also use virtual bindings if you don't like to change your DOM structure.

Upvotes: 1

Related Questions