Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: _ is not defined while using angular-google-maps

I'm getting ReferenceError: _ is not defined the angular-google-maps

I don't really understand why I'm getting this error, because I'm doing exactly what it is written on the website.

Also I searched for similar questions, but they didn't helped.

bundle.js

$ = window.$ = window.jQuery = require('./lib/jquery');
require('./lib/angular-simple-logger.js');
require('./lib/angular-google-maps.js');
require('./lib/lodash.js');

I'm importind bundle.js into the index.html. I also tried to use ngLodash, but no results.

app.js

var app = angular.module('app', [
  'ngLodash',
  'nemLogging',
  'uiGmapgoogle-maps'
]);

app.config(function(uiGmapGoogleMapApiProvider) {
    uiGmapGoogleMapApiProvider.configure({
       key: '{myKey}',
       v: '3.20',
       libraries: 'places' // I don't need the whole map, only the places
   });
});

Also I enabled the GoogleMaps Api from the Google Developer Console

Does someone have some experience with this library and can give me a hint?

like image 840
Paul Avatar asked Nov 04 '15 19:11

Paul


Video Answer


1 Answers

You need to add the _ underscore library as a dependency. npm install underscore, or add to your bower config, or whatever you use for dependecy management.

<script src="bower_components/underscore/underscore-min.js"></script>
like image 95
FlavorScape Avatar answered Sep 28 '22 17:09

FlavorScape