This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +39
-1
lines changed
2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -1544,7 +1544,6 @@ mechanism.
1544
1544
1545
1545
- **ngMessages:** due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
1546
1546
1547
-
1548
1547
The `ngMessagesInclude` attribute is now its own directive and that must
1549
1548
be placed as a **child** element within the element with the ngMessages
1550
1549
directive. (Keep in mind that the former behaviour of the
@@ -1567,6 +1566,26 @@ end of the container containing the ngMessages directive).
1567
1566
</div>
1568
1567
```
1569
1568
1569
+ - **ngMessages:** due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
1570
+
1571
+ it is no longer possible to use interpolation inside the `ngMessages` attribute expression. This technique
1572
+ is generally not recommended, and can easily break when a directive implementation changes. In cases
1573
+ where a simple expression is not possible, you can delegate accessing the object to a function:
1574
+
1575
+ ```html
1576
+ <div ng-messages="ctrl.form['field_{{$index}}'].$error">...</div>
1577
+ ```
1578
+ would become
1579
+ ```html
1580
+ <div ng-messages="ctrl.getMessages($index)">...</div>
1581
+ ```
1582
+ where `ctrl.getMessages()`
1583
+ ```javascript
1584
+ ctrl.getMessages = function($index) {
1585
+ return ctrl.form['field_' + $index].$error;
1586
+ }
1587
+ ```
1588
+
1570
1589
- **$http:** due to [5da1256](https://github.com/angular/angular.js/commit/5da1256fc2812d5b28fb0af0de81256054856369),
1571
1590
1572
1591
`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
170
170
Depending on where the `ngMessagesInclude` directive is placed it will be prioritized inline with the other messages
171
171
before and after it.
172
172
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
+
173
192
### ngOptions
174
193
175
194
The `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