문제

based on the docs for knockout.mapping.js it says that properties of a data object become observables, and lists become observableArrays, however I'm having an issue updating an observableArray that should be the product of ko.mapping.fromJS.

I've created the following fiddle:

http://jsfiddle.net/zjT6c/1/

Notice, when you click the add service button, the console shows that the observableArray is updated, however the formattedService computed value does not update. Any ideas what I'm doing wrong? The name is editable if you change the text area, but the computed value for the services list does not update when you push something onto it...

Thanks for any ideas!

도움이 되었습니까?

해결책

Solved my problem, I was using:

observableArray().push('some thing');

when I should have been doing:

observableArray.push('some thing');

Everything works once I do that.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top