我通过angular2-google-maps在Google地图上显示路径。 我的问题是当我尝试根据某个条件在折线上添加一个标记时,由我的方法检查" isDisplayable()"
<sebm-google-map [latitude]="lat" [longitude]="lng">
<sebm-google-map-polyline *ngFor="let user of followedUsers" [strokeColor]="user.IsSelected ? '#0277BD' : 'grey'">
<sebm-google-map-polyline-point *ngFor="let userDataEvent of user.UserData.EventsList" [latitude]="userDataEvent.Lat" [longitude]="userDataEvent.Long">
<sebm-google-map-marker *ngIf="userDataEvent.isDisplayable()" [latitude]="userDataEvent.Lat" [longitude]="userDataEvent.Long" [iconUrl]="user.IsSelected ? 'http://maps.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png' : 'http://maps.google.com/mapfiles/marker_grey.png' ">
</sebm-google-map-marker>
</sebm-google-map-polyline-point>
</sebm-google-map-polyline>
</sebm-google-map>
我遍历我的用户以显示每个用户路径,并通过事件列表来获取我的每一行。
我的UserDataEvent类:
import { EventData } from './EventData';
export class UserDataEvent {
ID: string;
Lat: number;
Long: number;
Date: string;
ListsEvent: EventData[];
isDisplayable(): boolean {
let result: boolean = false;
for (var eventData of this.ListsEvent)
{
if (eventData.TypeEvent == 1 || eventData.TypeEvent == 2 || eventData.TypeEvent == 7 || eventData.TypeEvent == 8) {
result = true;
}
}
return result;
}
}
我得到了例外:&#34; self.context。$ implicit.isDisplayable不是函数&#34;
我不明白为什么
答案 0 :(得分:0)