我在使用angular-leaflet-directive创建多个地图时遇到问题。
我有列表城市,我想使用ng-reapeat来显示许多地图。
这是代码
NoneType has no attribute __getitem__
警告错误<div ng-repeat="(key,city) in listCity" class="panel panel-info col-md-2" style=" height: 25%;">
<div class="panel-heading">{{city.name}}</div>
<div class="panel-body" style="width: 100%; height: 100%;">
<leaflet style="width: 100%; height: 90%;" center="{{city.place_id}}"></leaflet>
</div>
</div>
。
当我通过改变中心来测试时,&#39;与其他字符串然后它没有错误。
请帮我修理一下。
非常感谢你!!!!!!!
答案 0 :(得分:0)
根据example in the docs,您必须在中心属性中提供lat
,lng
和zoom
。
所以尝试这样的事情:
<div ng-repeat="city in listCity" class="panel panel-info col-md-2" style=" height: 25%;">
<div class="panel-heading">{{city.name}}</div>
<div class="panel-body" style="width: 100%; height: 100%;">
<leaflet style="width: 100%; height: 90%;" center="{ lat: city.lat, lng: city.lng, zoom: 10 }"></leaflet>
</div>
</div>
我假设你的listCity
是一个数组。