vendredi 8 mai 2015

knockout-postbox and knockout components can you syncWith observable arrays?

I have two components that I want to sync an observable array between them. It works find with an observable, but with an array it never syncs. Can you syncWith an observable array?

If I convert the array to string and then sync the observable it passes, but then I have to reconstruct the observable array on the other vm. Can it be done with just a syncWith?

vm1

  self.offers = ko.observableArray([]).syncWith("offersLink");


            var mappedLogs = $.map(allData, function (item) { return new model.offerList(item) });
            self.offers(mappedLogs);

vm2

 self.offers = ko.observableArray([]).syncWith("offersLink");

Aucun commentaire:

Enregistrer un commentaire