Javascript 错误:[$injector:nomod]尝试将第三方模块添加到应用程序时。

Javascript 错误:[$injector:nomod]尝试将第三方模块添加到应用程序时。,javascript,html,angularjs,mean-stack,meanjs,Javascript,Html,Angularjs,Mean Stack,Meanjs,我正在尝试将这个模块添加到我的mean应用程序中。我使用bower进行安装,其中包括以下示例 <!DOCTYPE html> <html ng-app="example"> <head lang="en"> <!-- Required dependencies --> <script src="https://maps.googleapis.com/maps/api/js?&libraries=places">

我正在尝试将这个模块添加到我的mean应用程序中。我使用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>

向mean应用程序中添加第三方模块的正确方法是什么?

看起来您的思路是正确的,您是否向该视图的控制器中注入了依赖项?

看起来您的思路是正确的,您是否将依赖项注入到该视图的控制器中?

在向我的应用程序添加第三方模块时,我遇到了相同的问题。检查此链接:

这就是为什么添加到我的mean应用程序中的ngDialog对你来说应该是一样的,除了CSS文件


据我所知,这是我添加第三方模块的唯一方法。

在我的应用程序中添加第三方模块时,我也遇到了同样的问题。检查此链接:

这就是为什么添加到我的mean应用程序中的ngDialog对你来说应该是一样的,除了CSS文件


据我所知,这是我添加第三方模块的唯一方法。

不确定您的确切意思。我完全按照示例中的方式将代码复制到另一个文件中。所以所使用的控制器是“MainCtrl”。我是新来的意思,所以我不确定,但是当你用“.view.html”而不是“.html”创建一个文件时,会有什么变化吗?在我尝试将模块注入旧的视图控制器之前,它是“itemController”,使用这行代码
angular.module('items').controller('ItemsController'),['$scope','$stateParams','$location','Authentication','Items','UserItem','google.places',
但它不起作用。我视图中的代码与我上面发布的代码*完全*相同。为什么代码在一个文件中起作用,而在另一个文件中不起作用?因此,如果我理解正确,您有一个链接,可以将用户带到您粘贴在那里的页面?我只要我键入url,代码就可以在这两个文件中工作,在本例中,
localhost:3000/modules/items/views/create item.client.view.html
localhost:3000/lib/angular google places autocomplete/example/basic.html
都可以工作。但是如果我在我的mean应用程序中跟踪到我的create-client.view.html的链接,它就不工作了。我不能我在标记中引用脚本目录的方式有问题。新文件是否在同一目录中?如果不是,可能需要将src位置更改为相对于它所在的目录。不确定您的确切意思。我将代码完全按照示例中的方式复制到了另一个文件中。因此使用的控制器是“MainCtrl.”我是新来的意思,所以我不确定,但是在我尝试将模块注入到旧的视图控制器中之前,当您使用“.view.html”而不是“.html”创建一个文件时,会发生一些变化,这是“itemController”,使用这行代码
angular.module('items').controller('ItemsController'),['$scope','$stateParams','$location','Authentication','Items','UserItem','google.places',
但它不起作用。我视图中的代码与我上面发布的代码*完全*相同。为什么代码在一个文件中起作用,而在另一个文件中不起作用?因此,如果我理解正确,您有一个链接,可以将用户带到您粘贴在那里的页面?我只要我键入url,代码就可以在这两个文件中工作,在本例中,
localhost:3000/modules/items/views/create item.client.view.html
localhost:3000/lib/angular google places autocomplete/example/basic.html
都可以工作。但是如果我在我的mean应用程序中跟踪到我的create-client.view.html的链接,它就不工作了。我不能我在标签中引用脚本目录的方式有问题。新文件是否在同一目录中?如果不是,可能需要将src位置更改为相对于它所在的目录。
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.