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

时间:2014-09-14 13:00:25

标签: javascript angularjs mean-stack angular-google-maps

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

我跑了:

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,我是否还必须在模块供应商依赖项中添加它?

1 个答案:

答案 0 :(得分: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']
    }
}