使用谷歌地图API V3具有角和browserify [英] Using Google Maps api V3 with angular and browserify

查看:164
本文介绍了使用谷歌地图API V3具有角和browserify的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用谷歌地图Javascript API第3角一个+ browserify应用程序内。

I am trying to use the Google Maps Javascript Api V3 inside a Angular + browserify app.

我不使用亭子。

previously我是做与requirejs,和git的枢纽millermedeiros / requirejs-一个插件叫做插件异步。

Previously I was doing that with requirejs, and a plugins on git hub millermedeiros/requirejs-plugins called async.

我能够加载GMaps实现这样的(大部分的时间,有时requirejs仍然requireing GMaps实现为时尚早。

I was able to load gmaps like this (most of the time, sometimes requirejs was still requireing gmaps too early.

 // load gmap as an amd module
 define(['config'], function(config){
     define('gmaps', ['async!http://maps.google.com/maps/api/js?v=3&sensor=false&libraries=places&key=' + config['google-map-api-key']],
         function(){
             return window.google.maps;
         }
     );
 });

Browserify是一种新的,我没有看到太多的文档在这个时刻,做你们有什么建议?

Browserify is kind of new, I don't see much documentation at this moment, do you guys have any recommendation ?

推荐答案

要包括CommonJS的不相容的脚本来看看Browserify-垫片变换:

To include CommonJS incompatible scripts have a look at Browserify-shim transform:

https://github.com/thlorenz/browserify-shim

这篇关于使用谷歌地图API V3具有角和browserify的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆