angular2如何动态更改输入变量

时间:2016-08-10 13:03:42

标签: angular typescript

如果问题没有正确设置,请说对不起,我希望通过向您展示这一点,我可以告诉您我的意思:

<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>

如您所见,我在标记标记中可以看到输入,并且我的Google地图上有一个名为的缩放事件:

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

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

1 个答案:

答案 0 :(得分: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;
 }
}