我目前有一个问题,我正在使用 Angular js 来获取和显示数据。以下是代码
var angularDynamicsCRM = angular.module('angularDynamicsCRM', ['ngResource']);
/// define the DynamicsCRMService factory
angularDynamicsCRM.factory('DynamicsCRMService', function ($resource) {
var oDataUrl = Xrm.Page.context.getClientUrl() + '/api/data/v9.1/';
var defaultParams = {};
/// describe our API actions
var actions = {
lookup: {
method: 'GET',
url: oDataUrl + ':Entityname?$select=:SelectQuery&$filter=:FilterQuery :RecordGuid',
headers: {
"Accept": "application/json",
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Prefer": "odata.include-annotations=\"*\""
}
}
};
/// create the service
return $resource(oDataUrl, defaultParams, actions)
});
我的控制器代码如下
DynamicsCRMService.lookup(
{
Entityname: SelectedRecord[n].lti_entityname,
RecordGuid: SelectedRecordID,
SelectQuery: SelectedRecord[n].lti_selectquery,
FilterQuery: SelectedRecord[n].lti_filterquery
},
function (response) {
setdata.push(response.value);
});
问题是每次我在我的控制器中使用上述内容时,我总是以不同的顺序获取数据(异步)任何人都可以提出一种方法,我可以按照同步而不是异步的特定顺序获取数据