在环境中不允许使用初始化程序

时间:2019-07-16 06:40:17

标签: typescript angular7

我有angular-google-map。我想在地图上查看共享相同纬度和经度的点的信息。对于该点的聚类,我正在使用angular-marker-cluster。在簇上单击它必须显示弹出集群中该点的信息。没有关于角度标记集群的事件。  https://gitter.im/SebastianM/angular2-google-maps/archives/2017/11/23

根据此博客,我们可以为cluster添加事件。我的打字稿版本为3.2.4。但它显示

node_modules/@agm/js-marker-clusterer/directives/marker-cluster.d.ts(34,46)中的错误:错误TS1039:在环境上下文中不允许初始化器。

// marker-cluster.d.ts

export declare class AgmMarkerCluster implements OnDestroy, OnChanges, OnInit, ClusterOptions {

    @Output() clusterClick = new EventEmitter<MouseEvent>();//shows error for this line

}

//。html

 <agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom" [styles]="styles" [disableDefaultUI]="false" [zoomControl]="true"
[scrollwheel]="false">
   <agm-marker-cluster (clusterClick)="clusterClick($event)">

       <agm-marker *ngFor="let m of markers; let i = index" (markerClick)="clickedMarker(infowindow, i)" [latitude]="m.location_details_lat"
    [longitude]="m.location_details_lon" [iconUrl]="m.icon">
         <agm-info-window #infowindow>
           <div>
             <h2>NODE: {{ m.NODE_ID }}</h2>
           </div>
           <div class="agm-info-content">

             <div class="content-row">
               <div>CMTS NAME</div>: {{ m.CMTS_NAME }}
             </div>
             <div class="content-row">
               <div>Status</div>: {{ m.STATUS }}
             </div>
             <div class="content-row">
               <div>Homes On Node</div>: {{ m.TOTAL_ADDR_CNT }}
             </div>
             <div class="content-row">
               <div> Homes Affected</div>: {{ m.ADDR_COUNT_TOTAL_ADDR }}
             </div>
             <div class="content-row">
               <div>Created Date</div>: {{ m.CREATE_DTM }}
             </div>
             <div class="content-row" *ngIf="m.STATUS=='inactive'">
               <div>Cleared Date</div>: {{ m.CLEARED_DTM }}
             </div>
             <div class="content-row">
               <div>Duration</div>: {{ m.duration }}
             </div>
           </div>


         </agm-info-window>
       </agm-marker>

     </agm-marker-cluster>
   </agm-map>

0 个答案:

没有答案