我使用nx作为我的 monorepo 管理工具,其中包含 typescript api 和 Angular 前端。
现在我正在尝试让我的项目在github codespaces内运行。
当我尝试为它们提供服务时,除了角度应用程序之外,一切都工作正常。
我得到和错误Invalid Host/Origin header。可以使用该--public-host标志来解决此问题。
这就是我现在如何使用 codespaces 环境变量CODESPACE_NAME和 nx cli 来服务我的 Angular 应用程序:
npx nx serve application --publicHost=${CODESPACE_NAME}-4080.githubpreview.dev:443
Run Code Online (Sandbox Code Playgroud)
我现在的问题是,是否可以在内部配置一个新目标project.json来为我的应用程序提供服务,例如npx nx run application:codespaces?
我已经尝试创建一个新目标,但它无法解析环境变量:
...
"codespaces": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "console:build:production"
},
"development": {
"browserTarget": "console:build:development"
}
},
"defaultConfiguration": "development",
"options": {
"publicHost": "${CODESPACE_NAME}-4080.githubpreview.dev:443",
"port": 4080
}
},
...
Run Code Online (Sandbox Code Playgroud) 我在 Angular 9 和 Angular Fire 6 中使用 Angular 通用。
我设法预渲染我的应用程序,npm run prerender没有任何错误。
我的路线得到预渲染,index.html文件看起来不错。
除了命令本身,它永远不会完成。
我得到的最后几行:
...
Prerendering 4 route(s) to {{projekt URL}}\browser
CREATE {{projekt URL}}\browser\index.html (66857 bytes)
CREATE {{projekt URL}}\browser\home\index.html (66857 bytes)
CREATE {{projekt URL}}\browser\edit\index.html (66857 bytes)
CREATE {{projekt URL}}\browser\login\index.html (66857 bytes)
Run Code Online (Sandbox Code Playgroud) 我正在使用Kendo UI中的RedialGauge和angular。
我rxjs每3分钟从一个api动态加载我的仪表数据,这是我的代码:
interval(2e5)
.pipe(
startWith(() => forkJoin(
this.service.getStatistics(),
this.service.otherCall()
)
),
switchMap(() => forkJoin(
this.service.getStatistics(),
this.service.otherCall()
)
),
retryWhen((err) => err.pipe(
take(3)
)
)
).subscribe(([statistics, others]) => {
this.statistics = statistics;
...
});
Run Code Online (Sandbox Code Playgroud)