【问题标题】:how to set ng-map marker visibility?如何设置 ng-map 标记可见性?
【发布时间】:2017-04-27 13:44:08
【问题描述】:

我正在尝试通过 html 属性设置 ng-map 标记可见性选项。 我已经挣扎了大约两个小时。 提前谢谢你。

<div ng-app="mapApp" ng-controller="mapController">
    <ng-map default-style="true" zoom="5" center="usa">

        <marker
                position="usa" options="{visible:false}">
        </marker>
    </ng-map>
</div>

这是我的小提琴https://jsfiddle.net/AlexLavriv/La52ggbw/1/

【问题讨论】:

    标签: angular ng-map


    【解决方案1】:

    您可以使用ng-if 禁用标记

    <div ng-app="mapApp" ng-controller="mapController">
        <ng-map default-style="true" zoom="5" center="usa">
    
            <marker ng-if="showMarkers"
                    position="usa" options="{...}">
            </marker>
        </ng-map>
    </div>
    

    在你的控制器中

    $scope.showMarkers=false;
    

    LIVE DEMO

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-27
      • 1970-01-01
      • 2017-10-31
      • 2016-07-19
      相关资源
      最近更新 更多