lundi 2 mai 2016

Cannot load gmaps using async

Laravel 5 + RequireJS + Gmaps + async = not working

Can somebody help me with loading google maps using async plugin ? I also tried goog plugin but it was unsuccessful too.

It throws following error: enter image description here

I can load map only synchronically but it is unsafe.

here is my code :

welcome.blade.php

<head>
    <title>Roads API Demo</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="">
    <script data-main="" type="application/javascript" src=""></script>
</head>

assets/js/gmapsApi.js

define(['async!http://ift.tt/NF9SGx'], function() {
    console.log("HIIIIIIIIIIIIII");

    // When I delete async and put only
    // http://ift.tt/NF9SGx
    // Then works fine .
});

assets/js/config.js

requirejs.config({
    baseUrl: "assets/js/lib", //require.js path=assets/js/lib/require.js
    paths: {
      main: "../main",
      gmapsApi : "../gmapsApi"
    },
    waitSeconds: 0
});

requirejs(["gmapsApi"]);

IMPORTANT NOTE : require.js path=assets/js/lib/require.js

All scripts are loaded good, I checked Sources and Network tab in chrome.

in module assets/js/gmapsApi.js

Not working: async!http://ift.tt/NF9SGx

Working fine : http://ift.tt/NF9SGx



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire