1

我在尝试将模块 (angular-google-maps) 添加到 Mean.js 时遇到问题

我跑了:

bower install angular-google-maps --save

然后将“google-maps”添加到 applicationModuleVendorDependencies 数组中的 public/config.js:

var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils', 'google-maps'];

但是当我尝试运行(使用 grunt)时,我得到一个错误:

Error: [$injector:nomod] Module 'google-maps' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

我还需要做其他步骤吗?在https://angular-ui.github.io/angular-google-maps/#!/use上,它说 angular-google-maps 依赖于 Lodash,我是否还必须在模块供应商依赖项中添加它?

4

1 回答 1

6

Angular-google-maps 不包含 google-maps js api。您需要手动将其添加到 config/env/all.js 中的 js-libs。这也是您可以添加 lodash 和 angular-google-maps js 文件的地方:

assets: {
    lib: {
        js: [
            '//maps.googleapis.com/maps/api/js?sensor=false',
            'public/lib/lodash/dist/lodash.underscore.js',
            'public/lib/angular-google-maps/dist/angular-google-maps.js']
    }
}
于 2014-10-04T17:08:22.697 回答