angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

Can't import 'angular-google-maps'

Open webdev16 opened this issue 9 years ago • 4 comments

I am working on ES6, gulp-babel, And here's the problem. I added following 3 lines to app.js

import _ from 'lodash'; import angular from 'angular'; import 'angular-google-maps';

And third line gives error "angular-google-maps.js:14022 Uncaught ReferenceError: _ is not defined". Could someone let me know what's the problem?

webdev16 avatar Aug 30 '16 12:08 webdev16

+1 for this issue. I am having the exact same issue with the same setup.

kundanvishen avatar Aug 31 '16 14:08 kundanvishen

I see this error in 2.3.4 but it goes away when I revert to 2.3.3

uberspeck avatar Sep 01 '16 15:09 uberspeck

it was introduced by https://github.com/angular-ui/angular-google-maps/commit/bb083cd640b22c4f398ff969c9df4502f2810131, it's expecting a lodash global, but it doesn't work with loaders, even JSPM (that uses SystemJS), if you are using npm:lodash, since it won't export a global.

my "hack" to fix this issue (since angular-google-maps is the only module misbehaving) is to force lodash as a global, if you are using JSPM, you can do it using

jspm install npm:lodash -o "{'format': 'global', 'main':'lodash.min.js', 'meta': { 'lodash.min.js':{'exports': '_', 'format': 'global'} }}"

The acceptance tests in this module is lackluster. js-rich-marker is another dependency that has to be hacked when using loaders for it to work. I'm having to use my own fork so I can use it https://github.com/pocesar/js-rich-marker/tree/1.0.0

pocesar avatar Sep 05 '16 20:09 pocesar

If someone added some grunt-babel processing to some JS, specs to test ES6 importing then I could work to satisfy those specs.

nmccready avatar Oct 05 '16 15:10 nmccready