Skip to content

Work with Popup() object without marker #1019

@bosiakov

Description

@bosiakov

Hello!

In my project I need to use the popup without marker. I could not find similar cases in the documentation and wrote this

Full example here

    $scope.map = null;
    leafletData.getMap('map').then(function(map) {
        $scope.map = map;
    });
    /* ... */
    $scope.createWindow = function(lat, lng) {
        var html = $compile("<button \
         ng-click='setSourceMarker(" + lat + ","+lng+")'>First button</button> \
         <button class='btn btn-danger btn-block' \
         ng-click='setDestinationMarker(" + lat + ","+lng+")'>Second button</button>")({});
        L.popup()
            .setContent(html[0])
            .setLatLng(L.latLng(lat, lng)).openOn($scope.map)
    }
    $scope.$on("leafletDirectiveMap.click", function(event, args) {
        var leafEvent = args.leafletEvent;
        $scope.createWindow(leafEvent.latlng.lat, leafEvent.latlng.lng)
    });

My problem - I can not send in setContent full html. In general, this method looks awful. What are the ways to solve the problem and whether it is possible to write better?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions