I have a .net 4.5 Web Api with OData EntitySetController
In client side I got the following js files loaded
jquery.min.js
q.min.js
datajs-1.1.1.min.js
breeze.debug.js
toastr.min.js
angular.js
when I call the following javascript
breeze.config.initializeAdapterInstance("dataService", "OData");
var manager = new breeze.EntityManager(serviceName);
var query = breeze.EntityQuery.from("Customers");
return manager.executeQuery(query).then(success).fail(fail);
function success(data) {
$log.info("Retrieved " + data.results.length);
return data.results;
}
function fail(data) {
$log.info("error " + data);
}
I see the following in my chrome network tab showing metadata and the json data are coming back nicely...
Request URL:http://localhost:49971/odata/$metadata
Status Code:200 OK, 1.8KB
Request URL:http://localhost:49971/odata/Customers
Status Code:200 OK, 3.3KB
BUT the success callback never fires, the fail callback gets executed. Can any one help please? All I see is
XHR finished loading: "http://localhost:49971/odata/$metadata". datajs-1.1.1.min.js:14
XHR finished loading: "http://localhost:49971/odata/Customers". datajs-1.1.1.min.js:14
[Q] Unhandled rejection reasons (should be empty):
[Error]
length: 0
__proto__: Array[0]
q.js:1010
error Error: OK
I then need to databind these to a ng-grid, ng-form and then finally send them back to database to serverside...
Some more code and screen shot
breeze.EntityQuery
.from("AddressTypes")
.using(new breeze.EntityManager(serviceName))
.execute()
.then(function(data) {
console.log(data); // never gets here very wierd
}).fail(function(e) {
console.log(e); // shows an error object with the AddressType Array
});
I see the AddresTypes array in fail callback...
update: I have temporarily switched to a BreezeContoller instead of EntitySetController in the backend, and commented out breeze.config.initializeAdapterInstance("dataService", "OData");
And I get my array in successCb. So I think I can infer I am running into trouble with DataJS. Really would like to stick with EntitySetController though...
.end()
afterfail()
will remove the "Unhandled rejection reasons (should be empty)" – Voltaic.done()
not.end()
– Voltaic'Should be empty: [] q.js:621'
. I do understand that output is by design from Q.js. But the fact remains the successCb never gets called and the data embeeded in the failureCb – Brinson