1
我在google地圖上通過angular2-google-maps顯示路徑。 我的問題是,當我嘗試在根據一定的條件polylinepoints添加標記,用我的方法檢查「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;
}
}
我得到了異常: 「self.context $ implicit.isDisplayable不是一個函數」
我不明白爲什麼
我不再爲該項目的公司工作,但我已經解決了這個問題。不管怎樣,謝謝你 :) – Morgan