JavaScript Error extending entity with a observableArray in Breeze via constructor

If I try to extend an entity in Breeze via constructor with something like:

breeze.EntityManager('ServiceUrl').metadataStore.registerEntityTypeCtor(
  'customer',
  function () {
    this.orders = ko.observableArray([]);
  }
);

I get a Knockout error when trying to set the new properties:

myCustomer.orders(newOrders);

The error is:

"Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."

The same work if I add it in the post-construction initializer. Am I doing something wrong?

Answer:1

I am creating an object var testobj=function(x) { var b,c; var a=x; var init=function(d,e,f) { a=d; b=e; c=f; }; return{ init:init, b:...

I am creating an object var testobj=function(x) { var b,c; var a=x; var init=function(d,e,f) { a=d; b=e; c=f; }; return{ init:init, b:...

I have a question about Javascript. I want to set some paragraphs on my page to hidden when the page loads, then have the paragraphs accessed by clicking on the heading. This is the html: <div id="...

I have a question about Javascript. I want to set some paragraphs on my page to hidden when the page loads, then have the paragraphs accessed by clicking on the heading. This is the html: <div id="...

Lazy loading tests: I am trying to build a test for Jasmine to test a method that uses Q.delay. To go around the 10 seconds wait i'm using Jasmine's clock: jasmine.Clock.tick(10010); This works on ...

Lazy loading tests: I am trying to build a test for Jasmine to test a method that uses Q.delay. To go around the 10 seconds wait i'm using Jasmine's clock: jasmine.Clock.tick(10010); This works on ...

  1. jasmine clock tick not working
  2. jasmine clock tick example
  3. jasmine clock tick
  4. jasmine.clock().tick(10)
  5. jasmine.clock.tick is not a function
  6. jasmine clock tick promise
  7. jasmine.clock().tick(101)

I'm having a problem with a jQuery function that appends tags, but it only occurs about 40% of the time. My tags are not completely wrapping my text. Here is my code: $.getJSON('/ycomb', function(...

I'm having a problem with a jQuery function that appends tags, but it only occurs about 40% of the time. My tags are not completely wrapping my text. Here is my code: $.getJSON('/ycomb', function(...