将Angular-Google-Maps添加到Mean.js

reu*_*b87 1 javascript angularjs mean-stack angular-google-maps

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

我跑了:

bower install angular-google-maps --save
Run Code Online (Sandbox Code Playgroud)

然后在applicationModuleVendorDependencies数组中将'google-maps'添加到public/config.js:

var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils', 'google-maps'];
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行(使用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.
Run Code Online (Sandbox Code Playgroud)

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

for*_*ert 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']
    }
}
Run Code Online (Sandbox Code Playgroud)