问题标签 [angular-cli-v7]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1449 浏览

angular - 使用jspdf和autotable获取表的所有数据

我想从我的表中获取所有数据,问题是我只获取第一页中的数据(因为分页)。我的桌子上有 200 个寄存器,但分页只显示了 100 个寄存器,我怎么能得到其他 100 个寄存器,它们在下一页中的 JSPDF 并使用 200 个寄存器生成 PDF。我的代码如下:

0 投票
0 回答
116 浏览

angular - 如何从内部文件夹结构Angular 7中读取文件名?

我有一个要求,例如在编写语言映射的 i18n 目录中的 assets 文件夹中有语言 json 文件,例如 da-DA.json de-DE.json。现在我想要一个下拉菜单,我可以让我的用户选择这些语言。但我面临着将其映射到我的组件的挑战。我在以下链接中看到了这些答案,其中指出不可能这样做link1 link2

所以我想知道哪种方法是实现这样的目标的正确方法。

0 投票
2 回答
1335 浏览

angular - 为什么我们需要在 angular prod build 中设置“--aot false”?

我知道“ ahead of time compilation”在构建时提供编译。还有很多其他优点,--aot例如

  • 应用程序是预编译的,所以没有这样的等待模板

  • 绑定错误将在构建时知道等。

但是,还有一个选项可以设置--aot为 false(对于 prod 构建也是如此)。为什么我们需要设置--aotfalse?换句话说,它--jit提供了什么样的优势?我只是想了解使用--aotover是否有任何缺点,--jit因为否则,听起来--aot即使在开发版本中我也应该始终使用。如果使用 没有权衡--aot,那么为什么不将其设置为ng buildand的默认值ng serve

0 投票
0 回答
321 浏览

angular - Angular sharing modules between lazy loaded modules - cli creates unwanted chunks

Given 2 lazy loaded modules tableau-de-bord and import. These 2 modules are both importing a common shared-module which is actually shared between all the modules of the app.

My problem is, when I run ng serve or ng build, I should have let's say 2 chunks for the two modules. Instead, I have 3 (src-app-modules-import-import-module.js, src-app-modules-tableau-de-bord-tableau-de-bord-module.js and default~src-app-modules-import-import-module~src-app-modules-tableau-de-bord-tableau-de-bord-module.js).

When I first created the import module and ran ng serve, that default~src thing was not there. Some times later, it appeared.

Of course if I delete that file, one of the two modules will fail to load.

It is really annoying because when I load one of import or tableau-de-bord, that file is downloaded too and it also increases the final size of the app.

So why is creating this file and can I get rid of it? If yes, how?

Note that i have other modules that have the same issue. The app is holding 8 modules but this doesn't happen on all of them.

Edit: Turns out it is because the two modules linked are importing one same module. For instance, import-module and tableau-de-bord-module are both importing FontAwesomeModule (I only need it in these two). I've removed the import on import-module and the default~src was gone.

Then I tryed to put FonAwesomeModule inside shared-module hoping it will be available on the modules where I need it without creating another linked chunk but nope. The chunk got created every time I use font-awesome in both modules.

So there come the question. How can I share a module between modules without having that default~src stuff created?

Is it even a normal behaviour?

0 投票
1 回答
379 浏览

angular - 运行 npm install -g @angular/cli 时出错

如何解决问题,请帮忙。(如果是这样的话,互联网连接速度是否比最低要求要慢?) C:\Windows\system32> node -v v12.16.2 C:\Windows\system32> npm -v 6.14.4 C:\Windows \system32> npm install -g @angular/cli npm 错误!在 '...r\n"},"deprecated":"`' 附近解析时 JSON 输入意外结束