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

ngMessage and ngBind do not work together #8089

Closed
43081j opened this issue Jul 7, 2014 · 9 comments
Closed

ngMessage and ngBind do not work together #8089

43081j opened this issue Jul 7, 2014 · 9 comments

Comments

@43081j
Copy link

43081j commented Jul 7, 2014

If you have a custom validation key (such as server in this case), and try bind the ngMessage element to some object you presumably have the error message in, it does not work.

<div ng-if="myForm.test.$dirty" ng-messages="myForm.test.$error">
    <span ng-message="server" ng-bind="errors.test"></span>
</div>

The above does not work, the span remains empty but visible and errors.test is indeed populated (and visible in scope, by trying angular.element($0).errors.test).

If you use a child, like so:

<span ng-message="server">
    <span ng-bind="errors.test"></span>
</span>

This works correctly.

Is this expected functionality or a bug? I have no issue with having to use a child if it is expected to behave this way.

Example here.

@Narretz Narretz added this to the Backlog milestone Jul 17, 2014
@btford btford removed the gh: issue label Aug 20, 2014
@jamesbrobb
Copy link

Just came across this issue as well, is there any update/progress on it? Thanks.

@OliverKK
Copy link

Same here. Any news on this?

@matsko
Copy link
Contributor

matsko commented Feb 23, 2015

This should work now in 1.4. But you need to use ngRepeat.

@matsko
Copy link
Contributor

matsko commented Feb 23, 2015

c9a4421

@vedraan
Copy link

vedraan commented Mar 30, 2015

Note that it also works like this: <span ng-message="server">{{errors.test}}</span>

@matsko
Copy link
Contributor

matsko commented Mar 30, 2015

Closing this for now since it is working in 1.4.

@matsko matsko closed this as completed Mar 30, 2015
@parliament718
Copy link

I'm experiencing this bug in 1.4.7

@Narretz
Copy link
Contributor

Narretz commented Oct 8, 2015

It seems like ng-message + ng-bind was never actually solved. It really doesn't work in 1.4.7: http://plnkr.co/edit/bubtiS5bULNiCw5ach6Y?p=preview

@Narretz Narretz reopened this Oct 8, 2015
Narretz added a commit to Narretz/angular.js that referenced this issue Oct 12, 2015
Narretz added a commit to Narretz/angular.js that referenced this issue Oct 12, 2015
Narretz added a commit to Narretz/angular.js that referenced this issue Nov 4, 2015
Fixes angular#8089

BREAKING CHANGE:

ngMessage is now compiled with a priority of 1, which means directives
on the same element as ngMessage with a priority lower than 1 will
be applied when ngMessage calls the $transclude function.
Previously, they were applied during the initial compile phase and were
passed the comment element created by the transclusion of ngMessage.
To restore this behavior, custom directives need to have
their priority increased to at least "1".
Narretz added a commit to Narretz/angular.js that referenced this issue Nov 4, 2015
Fixes angular#8089
Closes angular#13074

BREAKING CHANGE:

ngMessage is now compiled with a priority of 1, which means directives
on the same element as ngMessage with a priority lower than 1 will
be applied when ngMessage calls the $transclude function.
Previously, they were applied during the initial compile phase and were
passed the comment element created by the transclusion of ngMessage.
To restore this behavior, custom directives need to have
their priority increased to at least "1".
gkalpak pushed a commit to gkalpak/angular.js that referenced this issue Nov 23, 2015
Fixes angular#8089
Closes angular#13074

BREAKING CHANGE:

ngMessage is now compiled with a priority of 1, which means directives
on the same element as ngMessage with a priority lower than 1 will
be applied when ngMessage calls the $transclude function.
Previously, they were applied during the initial compile phase and were
passed the comment element created by the transclusion of ngMessage.
To restore this behavior, custom directives need to have
their priority increased to at least "1".
@yerol
Copy link

yerol commented Dec 9, 2015

You can place the message in a separate element inside ng-message until this issue is resolved. As in:

<span ng-message="required">
    <span ng-bind="errors.required"></span>
</span>

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

No branches or pull requests

9 participants