更新: 这是一个重现问题的链接
相关: 这是我的另一个问题,剑道UI地图发生了类似的问题,也许它可以帮助有人解决这个问题!它有一个失败和一个工作版本.
我在Angular单页面应用程序中使用Kendo UI的DataSource,DropDownList和Map.
我想为DropDownList和Map使用相同的DataSource对象.但是,Map的行为方式非常不可预测.
transport.read,但只是options.success立即使用静态值调用时,一切都按预期工作.正在进行两次通话.在整个工作日里,我一直在梳头,所以任何帮助都非常感谢.
数据源服务:
m.factory('ourDataSource', function(foo, bar, baz) {
return new kendo.data.DataSource({
transport: {
read: function(options) {
foo().then(function (result) {
return bar(result);
}).then(function (result) {
return baz(result);
}).then(function (result) {
options.success(result);
}).catch(function (err) {
options.error(err);
});
}
}
});
});
Run Code Online (Sandbox Code Playgroud)
控制器:
m.controller('ourController', ['ourDataSource', function(ourDataSource) {
// set the data source of the dropdownlist
this.ourDataSource = ourDataSource;
// set up the map layers
this.mapLayers = [{
type: …Run Code Online (Sandbox Code Playgroud) 有没有办法将地图置于标记之间的中心?使其中心在标记之间,考虑到标记是从远程加载的dataSource?