【发布时间】:2016-03-10 20:48:36
【问题描述】:
我正在尝试将这个:https://github.com/kuhnza/angular-google-places-autocomplete 模块添加到我的平均应用程序中。我用 bower 安装,其中包含以下示例。
<!DOCTYPE html>
<html ng-app="example">
<head lang="en">
<!-- Required dependencies -->
<script src="https://maps.googleapis.com/maps/api/js?&libraries=places"></script>
<script src="/lib/angular/angular.js"></script>
<!-- Google Places Autocomplete directive -->
<script src="/lib/angular-google-places-autocomplete/src/autocomplete.js"></script>
<script>
angular.module('example', ['google.places'])
// Setup a basic controller with a scope variable 'place'
.controller('MainCtrl', function ($scope) {
$scope.place = null;
});
</script>
</head>
<body ng-controller="MainCtrl">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Basic Usage</h1>
<form class="form">
<input class="form-control" g-places-autocomplete ng-model="place"/>
</form>
<h5>Result:</h5>
<pre>{{place | json}}</pre>
</div>
</div>
</div>
</body>
</html>
当我在 localhost 上运行我的应用程序并键入与示例位置对应的 url 时,一切正常。但是,如果我将此代码复制并粘贴到 view.html 中并点击指向该文件的链接,则该代码将不起作用。现在,如果我将 'google.places' 添加到 config.js 中的 var applicationModuleVendorDependencies 数组,我会收到以下错误。
Uncaught Error: [$injector:modulerr] Failed to instantiate module borowr due to:
Error: [$injector:modulerr] Failed to instantiate module google.places due to:
Error: [$injector:nomod] Module 'google.places' 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.
将 3rd 方模块添加到普通应用程序的正确方法是什么?
【问题讨论】:
标签: javascript html angularjs mean-stack meanjs