简体   繁体   中英

Angular: Reference object in template

I have:

<ng-container *ngIf="vortexFeed">
  <agm-marker
      *ngFor="let m of mVortex; let i = index"
      (markerClick)="clickedMarker(m.label, i)"
      [latitude]="m.lat"
      [longitude]="m.lng"
      [label]="m.label"
      [markerDraggable]="m.draggable"
      (dragEnd)="markerDragEnd(m, $event)">

    <agm-info-window>
      <strong>Alert</strong>
    </agm-info-window>

  </agm-marker>
</ng-container>

Instead of "Alert" I want m.class. How can I reference the "m" object?

if you want to output the m.class property you can use

 <agm-info-window>
  <strong>{{m.class}}</strong>
</agm-info-window>

more infos on string interpolation in the Angular docs

用{{m.class}}替换Alert

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM