Skip to content

Allow to customize when md-error is shown #4232

Closed
@coder925

Description

@coder925

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

I would like to be able to customize when the md-error directive is visible.
E.g. when ctrl.dirty && ctrl.invalid.

What is the current behavior?

As per #3560 my understanding is that the md-error is only shown when the control is: (isInvalid && (isTouched || isSubmitted))

What are the steps to reproduce?

See my Plunker.

  • Name1 is using md-error. Error will only show after control been touched.
  • Name2 is using an old workaround with md-hint. It can show error directly when dirty.

What is the use-case or motivation for changing an existing behavior?

For 99% of the time I believe the current implementation is the best behavior.

However, for special cases, you will need to be able to modify when errors are shown. For example instantly as the example from the Angular documentation.

Which versions of Angular, Material, OS, browsers are affected?

Angular v4.0.3
Material v2.0.0-beta.3

Is there anything else we should know?

I assume my request is not currently possible as my question on StackOverflow did not get any suggested answers.

Metadata

Metadata

Assignees

Labels

featureThis issue represents a new feature or feature request rather than a bug or bug fixneeds: discussionFurther discussion with the team is needed before proceeding

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions