小编Ara*_*nha的帖子

Angular 2'组件'不是已知元素

我正在尝试在其他模块中使用我在AppModule中创建的组件.我收到以下错误:

"未捕获(承诺):错误:模板解析错误:

'contacts-box'不是已知元素:

  1. 如果'contacts-box'是Angular组件,则验证它是否是此模块的一部分.
  2. 如果'contacts-box'是Web组件,则将'CUSTOM_ELEMENTS_SCHEMA'添加到此组件的'@NgModule.schemas'以禁止显示此消息.

我的项目结构很简单: 整体项目结构

我将页面保存在页面目录中,每个页面保存在不同的模块中(例如客户模块),每个模块都有多个组件(如customers-list-component,customers-add-component等).我想在这些组件中使用我的ContactBoxComponent(例如,在customers-add-component内部).

如您所见,我在widgets目录中创建了contacts-box组件,因此它基本上位于AppModule中.我将ContactBoxComponent导入添加到app.module.ts并将其放入AppModule的声明列表中.它没有用,所以我搜索了我的问题,并将ContactBoxComponent添加到导出列表中.没有帮助.我也尝试将ContactBoxComponent放在CustomersAddComponent中,然后放在另一个(来自不同的模块)中,但我得到一个错误,说有多个声明.

我错过了什么?

typescript angular-module angular-components angular

100
推荐指数
6
解决办法
9万
查看次数

连接到上游时 docker nginx 代理 nginx connect() 失败(111:连接被拒绝)

我正在尝试运行一个 nginx 容器作为我所有网站和 Web 服务的主要入口点。我设法将portainer作为容器运行,并且可以从 Internet 访问它。现在我正试图访问由另一个 nginx 容器托管的静态网站,但我没有这样做 - 当我转到 URL 时,我得到

502 Bad Gateway
Run Code Online (Sandbox Code Playgroud)

我已经尝试将上游部分添加到我的主要 nginx 配置中,但没有任何改变(每次配置更改后,我都会在容器内重新加载我的主要 nginx 服务)。

另一方面,如果可能的话,添加上游是我想避免的,因为产生多个不同的应用程序需要为每个应用程序添加一个上游 - 这比我预期的要多得多。

这是我的主要 nginx 配置文件:

events {
    worker_connections 1024;
}
http {
    server {
        listen 80;

        location /portainer/ {
            proxy_pass http://portainer:9000/;
        }
        location /helicon/ {
            proxy_pass http://helicon:8001/;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我如何启动我的主要 nginx 容器:

docker run -p 80:80 --name nginx -v /var/nginx/conf:/etc/nginx:ro --net=internal-net -d nginx
Run Code Online (Sandbox Code Playgroud)

这是我的静态网站的 nginx 配置文件:

events {
    worker_connections 1024;
}
http {
    server { …
Run Code Online (Sandbox Code Playgroud)

nginx proxypass docker

10
推荐指数
3
解决办法
1万
查看次数