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

feat(ngMessages): add support for default message #12213

Closed
wants to merge 2 commits into from

Conversation

gdangelo
Copy link

Added support for showing default message when no values are mapped with ng-message.

Closes #12008

Review on Reviewable

Added support for showing default message when no values are mapped with ng-message.

Closes angular#12008
@lgalfaso
Copy link
Contributor

it looks like this PR adds quite a few of duplicated code. Before doing a proper review, would it be possible to try to keep the core a little bit more DRY?

@gdangelo
Copy link
Author

gdangelo commented Jul 2, 2015

I will make the modifications soon.

Added a new param (boolean, isDefault) to the factory ngMessageDirectiveFactory, in order to reuse code in ngMessageDefault directive.

Closes angular#12008
@petebacondarwin petebacondarwin added this to the 1.5.x - migration-facilitation milestone Nov 1, 2015
@petebacondarwin
Copy link
Contributor

This looks reasonable let's get it into 1.6 early as soon as 1.5.0 is released.

@mjc-gh
Copy link

mjc-gh commented Jul 6, 2016

Any updates on this making it into 1.6?

* <div ng-messages="myForm.myField.$error" role="alert">
* <div ng-message="required">This field is required</div>
* <div ng-message="minlength">This field is too short</div>
* <div ng-message-default>This is a default message</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use a more meaningful message here to give a better impression of how to use the directive.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything in specific that should be mentioned here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything that you would use in an actual app. In this case, since these seem to be validation messages, the default message would be something like 'Valid' or a checkmark or 'This field is valid` etc.

@gkalpak
Copy link
Member

gkalpak commented Jul 6, 2016

A few more tests would be nice (e.g. using ng-messages-multiple or using ngIf on ngMessageDefault etc). But overall looks good.

@gdangelo
Copy link
Author

Hi @gkalpak, @mikeycgto, thanks to follow this feature request. Do we need anything else to include the feature in the 1.6 release?

@petebacondarwin
Copy link
Contributor

@gdangelo - yes, @gkalpak provided a number of comments that need addressing, including some more tests.

@Narretz Narretz modified the milestones: 1.6.4, 1.6.x Mar 8, 2017
@Narretz Narretz removed this from the 1.6.4 milestone Mar 8, 2017
@Narretz Narretz modified the milestones: 1.6.x, 1.7.x Apr 12, 2018
@Narretz Narretz self-assigned this May 3, 2018
@petebacondarwin petebacondarwin self-assigned this May 14, 2018
@Narretz Narretz closed this in 84d80be Jun 6, 2018
Narretz added a commit that referenced this pull request Jun 6, 2018
add support for showing default message when a truthy value is not matched by an ng-message directive.

Closes #12008
Closes #12213
Closes #16587
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants