使用Node.js将MongoDB与Leaflet连接起来时遇到问题

时间:2016-12-18 10:11:06

标签: javascript node.js mongodb leaflet angular-leaflet-directive

以下代码在我的网站地图上工作并显示我的标记(var testing),但当我切换并尝试从MongoDB中提取相同的JSON文件时,我无法将其显示在地图上。如何从我的控制器拨打服务电话?

Refused to display 'https://www.google.co.in/?gfe_rd=cr&ei=x2VWWLL2Ae-K8Qfwx4ngDQ' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

这是我想从我的控制器调用的服务功能:

.controller('MarkersSimpleController', function ($scope, $location, $http, Contacts1) {
    var testing = {
        "_id": {
            "$oid": "5855fa53942137001165e01c"
        },
            "marker": {
                "lat": 37.7798,
                "lng": -122.43598,
                "placename": "test",
                "message": "Drag me to add point!",
                "focus": true,
                "draggable": true,
                "description": "test",
                "url": "test",
                "entryname": "test",
                "time": "test"
            }
        };

    angular.extend($scope, {
        sanfran: {
            lat: 37.77,
            lng: -122.44,
            zoom: 12
        },
        markers: testing,
        position: {
            lat: 37.77,
            lng: -122.435
        },
        events: { // or just {} //all events
            markers:{
                enable: [ 'dragend' ]
                  //logic: 'emit'
            }
        }
    });

    $scope.$on("leafletDirectiveMarker.dragend", function(event, args){
        $scope.position.lat = args.model.lat;
        $scope.position.lng = args.model.lng;
    });
})

我觉得答案很简单,但我无法弄清楚如何让它发挥作用。 MongoDB的位置是{url} / contacts,采用JSON格式。

这是我的第一篇文章..我通常可以在网上找到我需要的东西,觉得我已经用尽了这些资源。每当我认为我与Mongo有联系时,这一点就不会出现在Leaflet上。非常感谢你!

0 个答案:

没有答案