Hi.
Can anyone help me with this? I have simple view page. I want to use google maps js api along with google places api. I don’t want to use any yii google extensions. So I’ve added this to my view.php:
$this->registerJsFile('https://maps.googleapis.com/maps/api/js?key=myKey&callback=initMap');
$this->registerJsFile('@web/assets/48746385/myCode.js');
//some code here
<div id="map"></div>
// rest of the code
Then to my myCode.js:
var map;
// Google Maps API
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
And nothing happens. Page renders ok, but my map doesn’t show.
I was looking for any topic, but all are about google extensions.