From c77fb503668c11580f2f920bffa4df9afa5e970f Mon Sep 17 00:00:00 2001 From: f Date: Tue, 1 Feb 2022 17:38:29 -0300 Subject: [PATCH] obtener el overlay antes que nada --- app/javascript/controllers/non_geo_controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/controllers/non_geo_controller.js b/app/javascript/controllers/non_geo_controller.js index 072c1b83..f8b86643 100644 --- a/app/javascript/controllers/non_geo_controller.js +++ b/app/javascript/controllers/non_geo_controller.js @@ -14,15 +14,15 @@ export default class extends Controller { static targets = [ 'lat', 'lng', 'map', 'overlay' ] async connect () { + const res = await fetch(this.element.dataset.map); + this.overlayTarget.innerHTML = await res.text(); + this.marker() this.latTarget.addEventListener('change', event => this.marker()) this.lngTarget.addEventListener('change', event => this.marker()) window.addEventListener('resize', event => this.map.invalidateSize()) - const res = await fetch(this.element.dataset.map); - this.overlayTarget.innerHTML = await res.text(); - this.map.on('click', event => { this.latTarget.value = event.latlng.lat this.lngTarget.value = event.latlng.lng