小编Eug*_*ene的帖子

angular-leaflet-directive自定义消息html,带有标记弹出窗口中的angular指令.如何?

我想将带有$ scope事件处理程序的自定义html标记插入到传单标记的message属性中.例如:

App.controller('testController', ['$scope', "leafletEvents", '$compile', 'leafletMarkersHelpers',
function($scope, leafletEvents, $compile, leafletMarkersHelpers){

angular.extend($scope, {
    currentLocation : {
        lat: 20,
        lng: 20,
        zoom: 20
    },
    markers: {
    },
    defaults: {
        scrollWheelZoom: true
    },
    events: {
        map: {
            enable: ['zoomstart', 'drag', 'click', 'mousemove', 'popupopen'],
            logic: 'emit'
        },
        markers: {
            enable: leafletEvents.getAvailableMarkerEvents()
        }
    }
});
var html = " <a href=''>info</a><button type='button' ng-click='doSomeAction()'>Choose</button>";
var item = {...}; //some data for marker
            $scope.markers["newMarker"] = {
                lat: item.lat,
                lng: item.lng,
                message: item.message + html,
                draggable: false …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs leaflet angular-leaflet-directive

6
推荐指数
1
解决办法
4841
查看次数