File tree 2 files changed +60
-0
lines changed
2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -1519,6 +1519,34 @@ describe('$q.when', function() {
1519
1519
});
1520
1520
```
1521
1521
1522
+ - **form:** Due to [94533e57](https://github.com/angular/angular.js/commit/94533e570673e6b2eb92073955541fa289aabe02),
1523
+ the `name` attribute of `form` elements can now only contain characters that can be evaluated as part
1524
+ of an Angular expression. This is because Angular uses the value of `name` as an assignable expression
1525
+ to set the form on the `$scope`. For example, `name="myForm"` assigns the form to `$scope.myForm` and
1526
+ `name="myObj.myForm"` assigns it to `$scope.myObj.myForm`.
1527
+
1528
+ Previously, it was possible to also use names such `name="my:name"`, because Angular used a special setter
1529
+ function for the form name. Now the general, more robust `$parse` setter is used.
1530
+
1531
+ The easiest way to migrate your code is therefore to remove all special characters from the `name` attribute.
1532
+
1533
+ If you need to keep the special characters, you can use the following directive, which will replace
1534
+ the `name` with a value that can be evaluated as an expression:
1535
+
1536
+ ```js
1537
+ angular.module('myApp').directive('form', function() {
1538
+ return {
1539
+ restrict: 'E',
1540
+ priority: 1000,
1541
+ compile: function(element, attrs) {
1542
+ var unsupportedCharacter = ':' // change accordingly
1543
+ if (attrs.name && attrs.name.indexOf(unsupportedCharacter) > 0) {
1544
+ attrs.$set('name', 'this["' + attrs.name + '"]');
1545
+ }
1546
+ }
1547
+ };
1548
+ });
1549
+ ```
1522
1550
1523
1551
<a name="1.4.3"></a>
1524
1552
# 1.4.3 foam-acceleration (2015-07-15)
Original file line number Diff line number Diff line change @@ -473,6 +473,38 @@ ngModelCtrl.$formatters.push(function(value) {
473
473
});
474
474
```
475
475
476
+
477
+ ### form
478
+
479
+ Due to [94533e57](https://github.com/angular/angular.js/commit/94533e570673e6b2eb92073955541fa289aabe02),
480
+ the `name` attribute of `form` elements can now only contain characters that can be evaluated as part
481
+ of an Angular expression. This is because Angular uses the value of `name` as an assignable expression
482
+ to set the form on the `$scope`. For example, `name="myForm"` assigns the form to `$scope.myForm` and
483
+ `name="myObj.myForm"` assigns it to `$scope.myObj.myForm`.
484
+
485
+ Previously, it was possible to also use names such `name="my:name"`, because Angular used a special setter
486
+ function for the form name. Now the general, more robust `$parse` setter is used.
487
+
488
+ The easiest way to migrate your code is therefore to remove all special characters from the `name` attribute.
489
+
490
+ If you need to keep the special characters, you can use the following directive, which will replace
491
+ the `name` with a value that can be evaluated as an expression:
492
+
493
+ ```js
494
+ angular.module('myApp').directive('form', function() {
495
+ return {
496
+ restrict: 'E',
497
+ priority: 1000,
498
+ compile: function(element, attrs) {
499
+ var unsupportedCharacter = ':' // change accordingly
500
+ if (attrs.name && attrs.name.indexOf(unsupportedCharacter) > 0) {
501
+ attrs.$set('name', 'this["' + attrs.name + '"]');
502
+ }
503
+ }
504
+ };
505
+ });
506
+ ```
507
+
476
508
### Templating (`ngRepeat`, `$compile`)
477
509
478
510
#### ngRepeat
You can’t perform that action at this time.
0 commit comments