title: Angular 10 - Openlayers get map coordinates on (click)
body: <p>I have an OpenLayers map in my Angular map component. I need to get the click coordinate of the map on the Angular <code>(click)</code> event. In Javascript is easy, just adding the following code:</p>
  <pre><code>map.on('click', function(evt) {
    var coordinate = evt.coordinate;
  }
  </code></pre>
  <p>In Angular on the <code>map.component.html</code>, I added the following code:</p>
  <pre><code>&lt;div id=&quot;map&quot; (click)=&quot;getCoord($event)&quot; class=&quot;map&quot;&gt;&lt;/div&gt;
  </code></pre>
  <p>And created the <code>getCoord()</code> function in my <code>map.component.ts</code> just like this:</p>
  <pre><code>getCoord(event: any){
      var coordinate = this.map.getEventPixel(event);
   }
  </code></pre>
  <p>For the same click event, javascript returns this coordinate, which is the one I need</p>
  <blockquote>
  <p>Array [ -180047.42012573266, 5279667.9723422285 ]</p>
  </blockquote>
  <p>But in angular, I get this one:</p>
  <blockquote>
  <p>Array [ 480, 221 ]</p>
  </blockquote>
  <p>Any idea of how can I get the correct coordinate using Angular, or how can I convert the second into the first one? I'm really stuck in this.</p>
  <p>Thanks!</p>