ReferenceError:使用angular-google-maps时未定义_

时间:2022-03-25 19:41:04

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

我得到了ReferenceError:_没有定义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.

我是importind bundle.js到index.html。我也试过使用ngLodash,但没有结果。

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

我还从Google Developer Console启用了GoogleMaps Api

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

有人对这个图书馆有一些经验,可以给我一个提示吗?

1 个解决方案

#1


5  

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.

您需要添加_ underscore库作为依赖项。 npm安装下划线,或添加到您的凉亭配置,或任何您用于依赖管理。

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

#1


5  

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.

您需要添加_ underscore库作为依赖项。 npm安装下划线,或添加到您的凉亭配置,或任何您用于依赖管理。

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