2016-08-10 154 views
1

輸入變量如果問題是不正確設置與正確的字遺憾的是,我希望我能讓你清楚我的意思是你展示這一點:angular2如何更改動態

<sebm-google-map-marker 
      *ngFor="let clustermarker of clusters" 
      (markerClick)="clustermarkerClicked()" 
      [latitude]="clustermarker.latitude" 
      [longitude]="clustermarker.longitude" 
      [iconUrl]="clustermarker.icon" 
      [visible]="true"> 
</sebm-google-map-marker> 

正如你看到我在標識器標籤可見的輸入,我有我的谷歌地圖上的zoomChange事件命名爲:

testFunction(e){ 
    console.log(e); 

    if (e === 17 || e === 18) { 
    Here I want to set the variable of visible to false 
} 
} 

回答

1
<sebm-google-map-marker 
      *ngFor="let clustermarker of clusters" 
      (markerClick)="clustermarkerClicked()" 
      [latitude]="clustermarker.latitude" 
      [longitude]="clustermarker.longitude" 
      [iconUrl]="clustermarker.icon" 
      [visible]="isVisible"> 
</sebm-google-map-marker> 
isVisible:boolean = false; 
testFunction(e){ 
    console.log(e); 

    if (e === 17 || e === 18) { 
    this.isVisible = true; 
} 
} 
+0

非常感謝你忘記我可以使用一個變量 - 「 - – Sreinieren