angularjs – 带有templateParameter属性的Angular google map window指令

前端之家收集整理的这篇文章主要介绍了angularjs – 带有templateParameter属性的Angular google map window指令前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 Angular-google-map库来显示带有这样的窗口的标记

<google-map center="map.center"
 zoom="map.zoom"
 draggable="true"
  bounds="" 
   options ="{styles:map.options}"
  >

    <marker ng-repeat="hotel in hotelsFiltered"
     idKey="hotel.id"
     coords="{latitude:hotel.latitude,longitude:hotel.longitude}"
     hoteldata="hotel"
     icon="icon">
    </marker>

    <window ng-repeat="hotel in hotelsFiltered"
     coords="{latitude:hotel.latitude,longitude:hotel.longitude}"
     templateUrl="hotel.templateUrl"
     templateParameter="{title:'myTitle'}"
     show="hotel.show"
    >

    </window>


</google-map>

所以在window指令中我提供了templateUrl,并且标记成功显示了信息窗口,但问题是我在templateParameter中提供的参数似乎无法在模板视图中访问.
这是我的infoWindow的模板视图以及我如何尝试从window指令访问传递的参数:

<div>
 {{title}}
 the title was not showed successfully 
</div>

解决方法

我有一个非常类似的问题,解决方案是更新模板中的绑定,如下所示:

<div>
   {{parameter.title}}
</div>

其余代码可以保持不变.

猜你在找的Angularjs相关文章