Hi, can someone tell me how to delete a google maps native marker


#1

Remove () and clear () do not work

import { Component } from '@angular/core';
import {UbicacionProvider} from '../../providers/ubicacion/ubicacion'
import { HomePage } from '../home/home';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { AgmCoreModule  } from 'angular2-google-maps/core';
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
import {GoogleMaps, GoogleMap, GoogleMapsEvent, LatLng, CameraPosition, MarkerOptions, Marker} from '@ionic-native/google-maps';


@IonicPage()
@Component({
  selector: 'page-robledo',
  templateUrl: 'robledo.html',
 
})
export class RobledoPage {
  map: GoogleMap;
  localision:any={};
  markerOptions: MarkerOptions;

  chofer:any[] = [];
 siguiendo:boolean = false;
  lat:number=6.2640347;
  lng:Number=-75.54877690000001;
  choferSeleccionado:any={};
    
  constructor(private _ubicacion:UbicacionProvider,
              public navCtrl: NavController,
              public navParams: NavParams,
             private afDB: AngularFireDatabase,
             private marker:Marker,
            ) 
              {
                /*---------------localizacion de los choferes---------------*/
      afDB.list('/Robledo').subscribe(choferes=>{
         
        this.chofer= choferes;

        console.log(this.chofer)


        
      });
/*----------------mi localizacio---------------*/
   this._ubicacion.localizacion().subscribe(data=>{
                              this.localision ={
                                                  lng:data.coords.longitude,
                                                  lat:data.coords.latitude
                                                }
     console.log( this.localision);
  //   this.loadMap(this.localision.lat,this.localision.lng);

                                    })

                                   
        


 
  }

  loadMap(lat,lng){
    let location : LatLng= new LatLng(lat,lng)
    this.map=new GoogleMap('map',{
      'controls':{
        'compass':true,
        'myLocationButton':true,
        'indoorPiker':true,
        'zoom':true
      },
      'gestures':{
        'scroll':true,
        'tilt':true,
        'rotate':true,
        'zoom':true
      },
      'camera':{
        'latLng':location,
        'tilt':30,
        'zoom':15,
        'bearing':50


      }

    })
    
    this.chofer.forEach(marker=>{
     setInterval(()=>{

        this.addMarker(marker.lat,marker.lng);
        console.log("esto es:"+marker)
        
        
         

        },0.5000)
       
        
      });

  }
 salir(){
   	this.navCtrl.setRoot(HomePage);
 }

 addMarker(lat,lng){
  this.markerOptions = {
    position: new LatLng(lat,lng),
    icon:'www/assets/img/busR.png',
  //  title:'marker.ruta'
  };
  this.map.addMarker(this.markerOptions);
  
  setTimeout(()=>{
  this.marker.remove()
  },0.5000)
 }

 
}