Flores
Flores

Reputation: 8942

Upgrade to knockoutjs 2.2 broke mapping plugin

I have this knockout code in my page:

  $.get('@Url.DataAction("Parameters", "Service")', { Id: newRun }, function (result) {
             self.MappedParameters(ko.mapping.fromJS(result));
  });

Where self.MappedParameters is an knockout observableArray.

This was working fine in knockout 2.1, but has stopped working in 2.2 (mapping plugin 2.3.2 and 2.3.3 tried), no error just not binds.

Is this a bug or am I using it wrong? Can't find any release notes on the knockout site.

Upvotes: 1

Views: 206

Answers (1)

Flores
Flores

Reputation: 8942

With this syntax it started working again:

  $.get('@Url.DataAction("Parameters", "Service")', { Id: newRun }, function (result) {
         ko.mapping.fromJS(result, {}, self.MappedParameters);
  });

Which in (my) theory is the same..

Apparently the one in the question works in 2.1 and NOT 2.2 and this one works in 2.2 and 2.1.

Upvotes: 1

Related Questions