小编Mis*_*jan的帖子

用户拖动地图后如何修复传单地图中心的标记?

嗨我在节点添加表单上使用自定义地图.我的标记使用lat和log设置为我当前的位置.现在我想,每当用户拖动或移动地图时,标记应该在中心(固定).我尝试过很多东西:

$ cordovaGeolocation.getCurrentPosition(options).then(function(position){

    $scope.latlong = position.coords.latitude + "," + position.coords.longitude;
    $rootScope.lati= position.coords.latitude ;
    $rootScope.long = position.coords.longitude;

    $scope.map.center = {
        lat: position.coords.latitude,
        lng: position.coords.longitude,
        zoom: 20
    };

    $scope.map.markers.now = {
        lat: position.coords.latitude,
        lng: position.coords.longitude,
        message: "Usted esta aqui!",
        draggable: false,
        focus: true

    };

    if ($rootScope.locationresults == undefined) {
        Util.getAddressOf(position.coords.latitude, position.coords.longitude).then(function(location) {
            $rootScope.locationresults = location[0].formatted_address;
            console.log(location);
        }, function(error) {
            console.error(error);
        });
    }


    $scope.$on("leafletDirectiveMap.move", function(event, args) {

        $scope.map.markers.now.setLatLng([0,0]).update();
        //$scope.map.markers.now.lat = $scope.map.center.lat;
        //$scope.map.markers.now.lng = $scope.map.center.lng;
        console.info(JSON.stringify($scope.map.markers.now));
    });

    $scope.$on("leafletDirectiveMap.drag", function(event, args){
        console.log(JSON.stringify($scope.map.center));
        //$scope.map.markers.now.setLatLng(0,0);
        $scope.map.markers.now.lat = …
Run Code Online (Sandbox Code Playgroud)

angularjs leaflet ionic-framework

3
推荐指数
1
解决办法
985
查看次数

如何在 ng-repeat 中调用函数

我尝试在 ng-repeat 的同时执行一个函数,以便能够使用重复本身的索引。但在这一刻只执行最后一次。

<div ng-repeat="i in arraysemanas" ng-init="add_days($index)">
    <a class="item item-icon-left fecha" href="#">
        <i class="icon calendar"></i>
        <p class="date_c">{{CurrentDate_1|  date:' EEEE dd MMMM'}}</p>
    </a>
</div>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

3
推荐指数
1
解决办法
3196
查看次数

标签 统计

angularjs ×2

ionic-framework ×1

javascript ×1

leaflet ×1