Angularjs-无法为自定义Google地图标记添加样式

时间:2019-04-02 17:16:45

标签: angularjs google-maps

我正在Web应用程序中使用google-maps,使用自定义标记在地图上显示一些数据。问题是,地图上要显示几种数据,每个对象都由type表示,这是一个数字。对于等于3的类型,我想使图片变圆(通过应用ng-style)。这就是我在地图上创建标记的方法:

HTML:

    <marker ng-repeat="pos in $ctrl.positions track by $index" 
            position="[{{ pos.lat + ',' + pos.lng }}]"
            title="{{pos.text}}" 
            icon="{{ pos.icon }}" 
            on-click="$ctrl.showMarkerInfo({{$index}})" 
            ng-class="{{pos.type == 3 ? 'roundProfilePic': '' }}">
    </marker>

roundProfilePic实际上是添加到Marker对象中的,但是由于某些奇怪的原因,自定义标记实际上被转换为带有div标签的img s,没有任何关系到Marker,因此我的roundProfilePic不会影响地图上的实际图像。这是这样的:

    <div style="position: absolute; left: 0px; top: 0px; z-index: 106; width: 100%;">
       <div title style="width: 40px; height: 40px; overflow: hidden; position: absolute; opacity: 0; cursor: pointer; touch-action: none; left: -679px; top: 259px; z-index: 299;">
          <img alt src="someLinkToTheImage" style="position: absolute; left: 0px; top: 0px; width: 40px; height: 40px; user-select: none; border: 0px; padding: 0px; margin: 0px; max-width: none; opacity: 1;"
       </div>
      <div>
         <img>
      </div>
    .
    .
    .
    .
    .
    </div>

如何将roundProfilePic应用于这些img内的div标签?

0 个答案:

没有答案
相关问题