ReferenceError: _ not detected when using angular -google-maps

I get ReferenceError: _ is not defined angular-google-maps

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

I also looked for similar questions, but they did not help.

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 am importing bundle.js into index.html . I also tried using ngLodash , but there were 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 }); }); 

I also included GoogleMaps Api from the Google Developer Console

Does anyone have any experience with this library and can give me a hint?

+5
source share
1 answer

You need to add the _ underscore library as a dependency. npm install underscore , or add bower to the configuration, or whatever you use to control dependecy.

 <script src="bower_components/underscore/underscore-min.js"></script> 
+5
source

Source: https://habr.com/ru/post/1235236/


All Articles