Angular material 步进样式
Angular material stepper styling
您好,我想像给定的图像一样自定义现有的 angular material 步进器 ui。
是否可以通过编程方式更改图标,如果有错误,那么它应该显示一个红色的错误图标
https://stackblitz.com/edit/angular-4rvy2s-sprtoe?file=app/stepper-overview-example.ts
请检查这个Stackblitz
我编辑了一些东西。
看看这个可能会有帮助
根据你的描述,这两种情况都是可以的,官方文档中有例子
1.自定义图标:
In order to use the custom step states, you must add the displayDefaultIndicatorType option to the global default stepper options which can be specified by providing a value for STEPPER_GLOBAL_OPTIONS in your application's root module.
来源+示例:https://material.angular.io/components/stepper/overview#step-states
2。错误状态:
If you want to show an error when the user moved past a step that hasn't been filled out correctly, you can set the error message through the errorMessage input and configure the stepper to show errors via the showError option in the STEPPER_GLOBAL_OPTIONS injection token.
来源+示例:https://material.angular.io/components/stepper/overview#error-state
您好,我想像给定的图像一样自定义现有的 angular material 步进器 ui。 是否可以通过编程方式更改图标,如果有错误,那么它应该显示一个红色的错误图标
https://stackblitz.com/edit/angular-4rvy2s-sprtoe?file=app/stepper-overview-example.ts
请检查这个Stackblitz
我编辑了一些东西。 看看这个可能会有帮助
根据你的描述,这两种情况都是可以的,官方文档中有例子
1.自定义图标:
In order to use the custom step states, you must add the displayDefaultIndicatorType option to the global default stepper options which can be specified by providing a value for STEPPER_GLOBAL_OPTIONS in your application's root module.
来源+示例:https://material.angular.io/components/stepper/overview#step-states
2。错误状态:
If you want to show an error when the user moved past a step that hasn't been filled out correctly, you can set the error message through the errorMessage input and configure the stepper to show errors via the showError option in the STEPPER_GLOBAL_OPTIONS injection token.
来源+示例:https://material.angular.io/components/stepper/overview#error-state