小编Nor*_*tko的帖子

在 nx project.json 中使用环境变量

我使用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 nx-workspace

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

Angular 通用“npm run prerender”命令永不停止

我在 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)

angular-universal angular

6
推荐指数
1
解决办法
345
查看次数

Kendo Angular UI Gauges在更新后自行调整大小

我正在使用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)

初始化加载后,一切都很好,仪表看起来像他们应该的 在此处输入图片说明

但是在下一次更新后,压力表会自行随机调整大小 在此处输入图片说明

kendo-ui angular

5
推荐指数
1
解决办法
101
查看次数