在當前項目中,我希望使用角度的$ 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