在当前项目中,我希望使用角度的$ http服务在我的Kendo数据源中发出HTTP请求,因为我使用的是此博客中描述的响应拦截器:KendoUI DataSource - 来自过滤器属性的OData查询字符串
http://www.espeo.pl/2012/02/26/authentication-in-angularjs-application
我在我的应用程序中使用KendoUI网显示的数据,这是我在从服务器JSON格式得到。出于某种原因,如果我在“transport”对象中指定了一个函数,并且只将URL发送到服务器(example.com/odata/Foo),而不是完整查询(example.com),则odata查询将被截断/ odata/foo?$ filter = barId lt 100)。
设置我的剑道数据源是这样的:使用的角度做工精细$ http服务
$scope.foo = new kendo.data.DataSource({
type: "odata",
pageSize: 25,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
transport: {
read: function (options) {
$http({
url: '/odata/foo',
method: 'GET',
params: options.data
})
.success(function (result) {
options.success(result);
});
},
parameterMap: function (options, type) {
return kendo.data.transports["odata"].parameterMap(options, type);
}
}
HTTP请求,我并没有用的问题。问题似乎是,我无法从我的kendo数据源中的“过滤器”对象获取查询部分(URL?$filter=[filter expression])
。我尝试过使用parameterMap选项,但是也没有给出所需的结果。
您是否在问如何使用$ http服务进行HTTP请求?你试过什么了? – Kobunite
使用角度工作的$ http服务的HTTP请求罚款,我没有问题。问题似乎是我无法从我的kendo数据源中的“过滤器”对象获取查询部分(URL?$ filter = [filter expression])。我尝试过使用parameterMap选项,但是也没有给出所需的结果。 – Steffen
Steffen,我有同样的问题。你有没有找到一种方法来实现这一目标? – kbmax