explooosion / Agm-Direction

This is the directive for @agm/core (not official)
https://robby570.tw/Agm-Direction-Docs/
MIT License
75 stars 26 forks source link

Custom infoWindow isn't working #64

Closed YogliB closed 5 years ago

YogliB commented 5 years ago

I tried following this answer, but the infoWindow stays the default option (address).

Live example

explooosion commented 5 years ago

Hi, please add renderOptions with suppressMarkers: true

HTML

<agm-map [latitude]="lat" [longitude]="lng">
    <agm-direction
      [origin]="origin"
      [destination]="destination"
      [markerOptions]="markerOptions"
      [renderOptions]="renderOptions"
    >
    </agm-direction>
  </agm-map>

TS

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  public lat = 24.799448;
  public lng = 120.979021;

  public origin: any = 'No. 1, Section 1, Taiwan Avenue, Central District, Taichung, Taiwan';
  public destination: any = 'No. 1 Guanqian Road, North District, Taichung City';

  // add renderOptions
  public renderOptions = {
    suppressMarkers: true,
  };

  public markerOptions = {
    origin: { infoWindow: 'ORIGIN' },
    destination: { infoWindow: 'DESTINATION' },
    waypoints: { infoWindow: 'WAYPOINT' },
  };
}