-2

I have an observable array. Assume that (object) data has Id, Name, Description

self.SelectedObjects =  ko.observableArray();
self.SelectedObjects.push(data);
self.SelectedObjects.push(data);

Line number 1 and 2 work fine. At line number 3 the debug point vanishes and never comes back.

Ahmad
  • 1
  • 1
  • 1
  • 5
    Your code should just work, something else is happening in your code which make this question impossible to answer. Please add more context to your question! Maybe in a JSFiddle which reproduces your problem... – nemesv Jul 01 '13 at 08:46
  • open javascript console. Do you have any errors here? – Ilya Jul 01 '13 at 09:23
  • Thank you for a very quick response. I think you are right and your hint helped, something else is happening. Not able to find so far but will update once I find out. – Ahmad Jul 01 '13 at 09:45

1 Answers1

1

this simple example works well, may be problem somewhere else

var viewModel = new function()
{
    var self = this;
    var data = {"id" : "id1", "name" : "name1"};
    self.SelectedObjects =  ko.observableArray();
    self.SelectedObjects.push(data);
    self.SelectedObjects.push(data);
}

ko.applyBindings(viewModel);

JSFiddle DEMO

Ilya
  • 29,135
  • 19
  • 110
  • 158