I try call OData v4 service with ODataAngularResources from typescript.
For test purpose I use Northwind Products OData Service
Here is code wich call service:
var results = this.$odataresource("http://services.odata.org/V4/Northwind/Northwind.svc/Products")
.odata()
.filter("UnitPrice", ">", 10)
.filter("Discontinued", true)
.take(2)
.query();
Request URL :http://services.odata.org/V4/Northwind/Northwind.svc/Products?$filter=(UnitPrice%20gt%2010)%20and%20(Discontinued%20eq%20true)&$top=2
Response :
{ "@odata.context":"http://services.odata.org/V4/Northwind/Northwind.svc/$metadata#Products",
"value":[
{
"ProductID":5,
"ProductName":"Chef Anton's Gumbo Mix",
"SupplierID":2,
"CategoryID":2,
"QuantityPerUnit":"36 boxes",
"UnitPrice":21.3500,
"UnitsInStock":0,
"UnitsOnOrder":0,
"ReorderLevel":0,
"Discontinued":true
},
{
"ProductID":9,
"ProductName":"Mishi Kobe Niku",
"SupplierID":4,
"CategoryID":6,
"QuantityPerUnit":"18 - 500 g pkgs.",
"UnitPrice":97.0000,
"UnitsInStock":29,
"UnitsOnOrder":0,
"ReorderLevel":0,
"Discontinued":true
}
]
}
Deserialized response:
[$promise: Promise, $resolved: false]
0: Resource
1: Resource
$promise: Promise
$resolved: true
@odata.context: "http://services.odata.org/V4/Northwind/Northwind.svc/$metadata#Products"
length: 2
__proto__: Array[0]
I would like have deserialized response as array of Product object.
I really dont’t know where can be problem.
In app I use ODataResources but also ngResource.