Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Show ngMessage only when field is dirty #7549

Closed
@willmruzek

Description

@willmruzek

I'm currently working on a project where validation messages are only shown when the form field is $dirty. I'm working with 1.3.0-beta.8 and ngMessages.

Is there / can there be a way to do this purely with ngMessages?

I could use ngIf but that seems to defeat the purpose of ngMessages.

One idea I had was to add a when attribute to <ng-messages>. The use would look like the following:

<ng-messages for="form.gameTitle.$error" when='form.gameTitle.$dirty'>
  <ng-message when="required">Please enter a title.</ng-message>
</ng-messages>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions