This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -1392,7 +1392,6 @@ mechanism.
13921392
13931393- **ngMessages:** due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
13941394
1395-
13961395The `ngMessagesInclude` attribute is now its own directive and that must
13971396be placed as a **child** element within the element with the ngMessages
13981397directive. (Keep in mind that the former behaviour of the
@@ -1415,6 +1414,26 @@ end of the container containing the ngMessages directive).
14151414</div>
14161415```
14171416
1417+ - **ngMessages:** due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
1418+
1419+ it is no longer possible to use interpolation inside the `ngMessages` attribute expression. This technique
1420+ is generally not recommended, and can easily break when a directive implementation changes. In cases
1421+ where a simple expression is not possible, you can delegate accessing the object to a function:
1422+
1423+ ```html
1424+ <div ng-messages="ctrl.form['field_{{$index}}'].$error">...</div>
1425+ ```
1426+ would become
1427+ ```html
1428+ <div ng-messages="ctrl.getMessages($index)">...</div>
1429+ ```
1430+ where `ctrl.getMessages()`
1431+ ```javascript
1432+ ctrl.getMessages = function($index) {
1433+ return ctrl.form['field_' + $index].$error;
1434+ }
1435+ ```
1436+
14181437- **$http:** due to [5da1256](https://github.com/angular/angular.js/commit/5da1256fc2812d5b28fb0af0de81256054856369),
14191438
14201439`transformRequest` functions can no longer modify request headers.
Original file line number Diff line number Diff line change @@ -170,6 +170,25 @@ other inline messages situated as children within the `ngMessages` container dir
170170Depending on where the `ngMessagesInclude` directive is placed it will be prioritized inline with the other messages
171171before and after it.
172172
173+ Also due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
174+ it is no longer possible to use interpolation inside the `ngMessages` attribute expression. This technique
175+ is generally not recommended, and can easily break when a directive implementation changes. In cases
176+ where a simple expression is not possible, you can delegate accessing the object to a function:
177+
178+ ```html
179+ <div ng-messages="ctrl.form['field_{{$index}}'].$error">...</div>
180+ ```
181+ would become
182+ ```html
183+ <div ng-messages="ctrl.getMessages($index)">...</div>
184+ ```
185+ where `ctrl.getMessages()`
186+ ```javascript
187+ ctrl.getMessages = function($index) {
188+ return ctrl.form['field_' + $index].$error;
189+ }
190+ ```
191+
173192### ngOptions
174193
175194The `ngOptions` directive has also been refactored and as a result some long-standing bugs
You can’t perform that action at this time.
0 commit comments