Skip to content
Browse files

feat(ngMessages): provide support for dynamic message resolution

Prior to this fix it was impossible to apply a binding to a the
ngMessage directive to represent the name of the error. It was also
not possible to use ngRepeat or any other structural directive to
dynamically update the list of messages. This feature patch ensures
that both ngMessages can render expressions and automatically update
when any dynamic message data changes.


The `ngMessagesInclude` attribute is now its own directive and that must
be placed as a **child** element within the element with the ngMessages
directive. (Keep in mind that the former behaviour of the
ngMessageInclude attribute was that all **included** ngMessage template
code was placed at the **bottom** of the element containing the
ngMessages directive; therefore to make this behave in the same way,
place the element containing the ngMessagesInclude directive at the
end of the container containing the ngMessages directive).

<!-- AngularJS 1.3.x -->
<div ng-messages="model.$error" ng-messages-include="remote.html">
  <div ng-message="required">Your message is required</div>

<!-- AngularJS 1.4.x -->
<div ng-messages="model.$error">
  <div ng-message="required">Your message is required</div>
  <div ng-messages-include="remote.html"></div>

Closes #10036
Closes #9338
  • Loading branch information
Matias Niemelä
Matias Niemelä committed Feb 12, 2015
1 parent 732776f commit c9a4421fc3c97448527eadef1f42eb2f487ec2e0
Showing with 594 additions and 191 deletions.
  1. +371 −127 src/ngMessages/messages.js
  2. +223 −64 test/ngMessages/messagesSpec.js

0 comments on commit c9a4421

Please sign in to comment.
You can’t perform that action at this time.