OpenLayers 3 覆盖导致类型错误

OpenLayers3 overlay causes TypeErrors

我正在尝试从一些动态构造的数据向我的地图添加叠加层。

map.addLayer(new ol.Overlay({
    position: locations[i],
    positioning: 'center-center',
    element: document.getElementById(screen.id)
}));

我假设我作为 screen.id 传递的元素的 ID 有问题,但这是一个假设,因为当我尝试它时,每次我尝试交互时它都会向控制台发送垃圾邮件用我现在空白的地图。

ol.js:186 Uncaught TypeError: a.bf is not a function
(anonymous function) @ ol.js:186
l.forEach @ ol.js:80
l.bf @ ol.js:186
l.xo @ ol.js:407
(anonymous function) @ ol.js:394

None 其中对我意义重大。任何人都可以阐明错误试图告诉我什么吗?

愚蠢地尝试将叠加层添加为图层。有趣的是,它不会抛出异常,它只是接受它并默默地破坏地图。