问题标签 [ng-zorro-antd]

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 回答
289 浏览

ng-zorro-antd - 如何使用 nz-tabset 实现离开前的保存?

我正在使用 zorro antd 实现多标签功能,我想在用户有未保存的更改时警告我的用户,并且只有在用户确认后才离开标签。离开选项卡之前似乎没有回调,(nzSelectChange)是选项卡更改后而不是之前的回调。那么如何使用 zorro 的 nz-tabset 实现这样的功能呢?

0 投票
1 回答
1688 浏览

angular - Angular Ant Design DatePicker 默认模式

我正在使用 Ant Design for Angular 库,我想知道是否可以使用datepicker为日历视图指定默认模式的组件。

具体来说,我希望我的日期选择器以“年份”模式打开,如下面的截图所示

在此处输入图像描述

选择年份后,应提示您选择月份,最后选择日期。从文档看起来他们有一个year-picker,但是 - 正如名称所描述的 - 只允许选择特定的年份,而不能选择月份和日期。您知道任何解决方法吗?

0 投票
4 回答
1585 浏览

angular7 - ng-zorro datepicker 组件在延迟加载功能模块中的错误

如果在核心 app.module 中导入 Ant Design 的 NG-ZORRO,则非常简单

我的用例:我想在 UiLibraryModule 中加载 ngZorro(它设置 Zorro 的提供者并重新导出 NgZorroAntdModule)并通过 Feature1Module 将其导入,并跳过它在 app.module 中导入(对于更轻的 vendor.js)

如果 ng-zorro包含在 app.module 中,则在调用 ng-zorro datepicker 组件时会出现此错误: StaticInjectorError(AppModule)[DatePipe]: ..... NullInjectorError: No provider for DatePipe!

如果 UiLibraryModule 也在 app.module 中导入,一切正常(但自然而然,有一个巨大的 vendor.js)

问题(最佳猜测):ngZorro 只有在核心 app.module 中导入时才能正常工作。但这违背了 Feature1Module 延迟加载它的全部目的。

关于如何完全从延迟加载的模块加载 ng-zorro 有什么建议吗?

0 投票
2 回答
3838 浏览

ng-zorro-antd - 如何使用角度 css 组件设置 ng-zorro 组件的样式?

我有一个问题,例如:

我不喜欢 ng-zorro 桌子上的边距。在我的浏览器中,我可以看到它从.ant-table-small>.ant-table-content>.ant-table-body选择器中获取边距。

有什么方法可以覆盖它吗?

它在 ng-zorro theme.less 中不存在。对于这个菜鸟问题,我感到非常抱歉。

0 投票
2 回答
1364 浏览

angular - How to spread tab items evenly?

I'm developing new administration page. On that registration page I need to have a menu with five tabs for each administration section. We are using ant for angular and for tab menu we are using component from ant library.

I have tried to override style for ant tabs as described here:

How To Evenly Space Tabs Across the Whole Tab Bar

and here

https://github.com/NG-ZORRO/ng-zorro-antd/issues/2242

None of those articles helped.

Here is code example

I would like to have a evenly spaced element inside

0 投票
1 回答
683 浏览

angularjs - 如何使用 NG-ZORRO 实现持久抽屉?

我正在尝试使用NG-ZORROR 抽屉实现持久抽屉

目前 NG-ZORROR 抽屉仅在覆盖模式下可用,这对平板电脑来说很好,但我希望有一个菜单可以在桌面打开时推送内容。

我想以material-ui抽屉解决方案之类的东西结束。

谢谢。

0 投票
1 回答
1938 浏览

angular - NG-ZORRO - 覆盖库中的默认样式

我有一个 Angular 库,由 ng-packagr 打包,它包装了NzTableComponent.
例如,我需要通过覆盖默认样式来提供自定义样式

但是,将其放在组件.less文件中

table-custom.component.less

似乎它不起作用。任何想法?

0 投票
2 回答
67 浏览

angular - Limit how much times directive executes the method

I have a list of buttons that route to various links:

I use the directive [nzSelected] and function:

to highlight the button to the currently opened route. I have noticed a problem - this makes performance worse, because on each route change, the method 'isSelected' is launched more than 100 times.

What would be the best solution to avoid method execution so much times on each page change?

0 投票
1 回答
1887 浏览

ng-zorro-antd - 从 *ngFor 调用的 nz-dropdown-menu

我有一个简单的 ngFor,我希望每个条目都有一个带有下拉菜单的按钮,并且每个菜单项应该为 ngFor 中的特定项目调用不同的函数。

下面的代码有效,并且行为是我所期望的。

但是我得到了错误:

ng-zorro-antd-core.js:658 [NG-ZORRO]: deprecated: 'nz-dropdown' 组件 > 将在 9.0.0 中删除。请改用“nz-dropdown-menu”。

NG-ZORRO 建议的代码是:

如果我使用文档中建议的 NG-ZORRO 之类的代码,如何将 ngFor 中的“订单”项传递给子菜单上的“点击”?

0 投票
2 回答
1431 浏览

angular - 如何强制 nz-input-number 更改模型 onkeypress 而不是 onblur?

我需要在用户输入时更新数据nz-input-number。默认情况下,在普通<input>模型上会以这种方式更改。也许我错过了执行此操作的选项...我举了一个例子来说明 nz-input-number 和原始输入之间的区别。 https://stackblitz.com/edit/angular-mvf5yn