问题标签 [angular8]

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 投票
2 回答
1474 浏览

angular8 - @angular/material 自动完成的性能问题

我正在使用 Angular/Material 自动完成。将数据加载到自动完成时会遇到严重的性能问题,例如渲染大约需要 30 秒,并且需要 10 多秒才能稳定,数据是从服务器加载的,从服务器接收的数据非常快。为了克服这个问题,我使用了 cdkVirtualScroll,在向下滚动到结束并再次单击文本框后,它在滚动其加载值后加载空弹出窗口。

html

TS

检查前:https ://stackblitz.com/edit/angular-7vcohv?file=src%2Fapp%2Fapp.component.html

0 投票
2 回答
1487 浏览

angular - 无法使用 Angular 8 升级 Angular 材质

我做了更新指南(复杂应用程序)中描述的所有事情,但它一直在失败并ng update @angular/material出现以下错误:

0 投票
2 回答
925 浏览

angular - Angular 8,Angular Flex 布局:this._delegate.setClass 不是函数

更新到 Angular 8,我所有使用 angular flex 并具有 ngClass 的代码都被破坏了:

渲染时返回错误: ERROR TypeError: this._delegate.setClass is not a function

只能通过删除动态响应后缀 ( [ngClass]="{'mobile-no-padding': true}) 来解决这个问题,但这是一个很大的退步......

0 投票
7 回答
143453 浏览

angular - 我应该如何在 Angular 8 中为 @ViewChild 使用新的静态选项?

我应该如何配置新的 Angular 8 view child?

对比

哪个更好?我什么时候应该使用static:truevs static:false

0 投票
2 回答
2177 浏览

angular - Do I need to opt-in to Ivy to use dynamic imports when lazy loading routes (Angular 8)?

I've recently upgraded to Angular 8 and want to make use of the new dynamic imports feature.

I want to convert this:

To this:

However my code editor (VSCode) throws a Dynamic import is only supported when '--module' flag is 'commonjs' or 'esNext' error, which I'm unsure how to fix.

On the Angular update guide (https://update.angular.io/), when talking about using the new import syntax, it says:

For lazy loaded modules via the router, importing via string is deprecated. ng update will take care of this automatically. The new syntax leverages the ecosystem wide support for import rather than our custom rewrites.

ng update did not do this automatically and throws the aforementioned error when manually changing the syntax.

I read an article by one of the maintainers of this new feature and he mentions that I will need to opt-in to Ivy.

I'm not sure if this is an Angular 8 bug, or if I will need to opt-in to Ivy (in which case, the docs need to be clearer)

My package.json:

0 投票
1 回答
2371 浏览

angular - 将布尔列绑定到 ngx-datatable 中的复选框

如何将布尔列绑定到 ngx-datatable 中的复选框?目前我正在使用角度材料表并使用以下方法:

迁移到 ngx-datatable 时如何使用上述代码?我找不到样品。到目前为止,我看到的唯一示例是 http://swimlane.github.io/ngx-datatable/#chkbox-selection ,它没有解释如何将布尔列绑定到复选框。

0 投票
2 回答
3122 浏览

javascript - 升级到 Angular 8 后延迟加载中的路由错误

我已经升级到 Angular 8 并找到了延迟加载模块路由。虽然升级 CLI 本身根据新语法改变了我所有的延迟加载路由。

./src/app/app.routing.ts 中的错误 31:36 模块解析失败:意外令牌 (31:36) 您可能需要适当的加载程序来处理此文件类型。| 标题:“ABC” | },

| }, | {

children: [ {path: '', pathMatch: 'full', component: InfoComponent, canActivate: [AuthGuard], }, { path: 'abc', loadChildren: () => import('abc/abc.module').then((m) => m.AbcModule), }]

0 投票
10 回答
80672 浏览

javascript - Angular 8 - 延迟加载模块:错误 TS1323:仅当“--module”标志为“commonjs”或“esNext”时才支持动态导入

当我将 Angular 从 7 更新到 Angular 8 时,延迟加载模块出现错误

我已经尝试了角度升级指南中的选项

进行了以下更改:

错误 TS1323:仅当“--module”标志为“commonjs”或“esNext”时才支持动态导入。

0 投票
3 回答
3465 浏览

angular - 从具有不兼容对等依赖的 7 个错误升级到 Angular 8

ng 更新 @angular/cli @angular/core 。- 按照https://update.angular.io/#7.0:8.0中的指南从 7 升级到 8 时出现以下错误

0 投票
2 回答
4034 浏览

sass - Bootstrap & angular 8. _root.scss 中未定义的变量

我今天尝试将我的项目更新到 angular 8.0.0,但我遇到了引导程序问题,我找不到解决方案。

我使用引导程序 4.3.1

当我这样做时ng serve,我收到此错误:

在我的 angular.json 中,我有这个(我只包括了与 scss 相关的部分):

根据我对错误的理解,这是由于全局 scss 变量不可用,在 中"./node_modules/bootstrap/scss/bootstrap.scss",它看起来像这样:

$colors 变量在 中定义"variables",因此它应该在 中可用"root"

知道我在这里做错了什么吗?