yii2-google-maps-library
yii2-google-maps-library copied to clipboard
google is not defined
Hello, via composer installed this package.
When i copy paste "service" below in readme i get Uncaught ReferenceError: google is not defined.
Even when i have in view on top this: use dosamigos\google\maps\MapAsset; MapAsset::register($this);
google is not defined on the javascript console? If that is the case, make is an issue with the registration of the assets not the extension library itself.
How do you render the file? Where is actually located the registration of the assets? At the top of what? The Layout? The partial view? The more info0rmation your provide the better. Thanks.
In the case of renderAjax, only the first call the console says that google is not defined
, from the second call on instead it works...
I think solved it, adding your asset to the main asset as a dependency.
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
'css/custom.css',
'https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css',
'https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback'
];
public $js = [
'js/jquery.mask.js',
];
public $depends = [
'dosamigos\google\maps\MapAsset'
];
}