Error creating Circle object in ionic 3

0

Hello, I am using the Google Maps API. Where I have to create a circle around the market created. I perform it with (works correctly)

createCircle(loc: LatLng){

    return  this.map.addCircle(
      {'center': loc,
      'radius': 300,
      'strokeColor' : '#AA00FF',
      'strokeWidth': 5,
      'fillColor' : '#880000'}

    );;

}

My error appears when I try to create a Circle variable

circle:Circle;

and I try to change the method by

  createCircle(loc: LatLng){

 this.circle =   this.map.addCircle(
      {'center': loc,
      'radius': 300,
      'strokeColor' : '#AA00FF',
      'strokeWidth': 5,
      'fillColor' : '#880000'}

    );

    return this.circle;
}

I see this error.

What is my mistake ... thank you very much.

    
asked by Gerard_jcr 20.11.2017 в 01:32
source

1 answer

0

I answer do the following

circle:Circle;

and change the method to

createCircle(loc: LatLng){

    this.map.addCircle({
      'center': loc,
      'radius': this.radius,
      'strokeColor': '#AA00FF',
      'strokeWidth': 5,
      'fillColor': '#880000'
    }).then((circle: Circle) => {
      this.circle = circle;
    })

    return this.circle;
}
    
answered by 25.11.2017 / 18:36
source