|
531 | 531 | * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
|
532 | 532 | *
|
533 | 533 | *
|
534 |
| - * #### `replace` (*DEPRECATED*) |
535 |
| - * |
536 |
| - * `replace` will be removed in next major release - i.e. v2.0). |
| 534 | + * #### `replace` |
| 535 | + * <div class="alert alert-danger"> |
| 536 | + * **Note:** `replace` is deprecated in AngularJS and has been removed in the new Angular (v2+). |
| 537 | + * </div> |
537 | 538 | *
|
538 | 539 | * Specifies what the template should replace. Defaults to `false`.
|
539 | 540 | *
|
|
983 | 984 | compiled again. This is an undesired effect and can lead to misbehaving directives, performance issues,
|
984 | 985 | and memory leaks. Refer to the Compiler Guide {@link guide/compiler#double-compilation-and-how-to-avoid-it
|
985 | 986 | section on double compilation} for an in-depth explanation and ways to avoid it.
|
| 987 | +
|
| 988 | + * @knownIssue |
| 989 | +
|
| 990 | + ### Issues with `replace: true` |
| 991 | + * |
| 992 | + * <div class="alert alert-danger"> |
| 993 | + * **Note**: {@link $compile#-replace- `replace: true`} is deprecated and not recommended to use, |
| 994 | + * mainly due to the issues listed here. It has been completely removed in the new Angular. |
| 995 | + * </div> |
| 996 | + * |
| 997 | + * #### Attribute values are not merged |
| 998 | + * |
| 999 | + * When a `replace` directive encounters the same attribute on the original and the replace node, |
| 1000 | + * it will simply deduplicate the attribute and join the values with a space or with a `;` in case of |
| 1001 | + * the `style` attribute. |
| 1002 | + * ```html |
| 1003 | + * Original Node: <span class="original" style="color: red;"></span> |
| 1004 | + * Replace Template: <span class="replaced" style="background: blue;"></span> |
| 1005 | + * Result: <span class="original replaced" style="color: red; background: blue;"></span> |
| 1006 | + * ``` |
| 1007 | + * |
| 1008 | + * That means attributes that contain AngularJS expressions will not be merged correctly, e.g. |
| 1009 | + * {@link ngShow} or {@link ngClass} will cause a {@link $parse} error: |
| 1010 | + * |
| 1011 | + * ```html |
| 1012 | + * Original Node: <span ng-class="{'something': something}" ng-show="!condition"></span> |
| 1013 | + * Replace Template: <span ng-class="{'else': else}" ng-show="otherCondition"></span> |
| 1014 | + * Result: <span ng-class="{'something': something} {'else': else}" ng-show="!condition otherCondition"></span> |
| 1015 | + * ``` |
| 1016 | + * |
| 1017 | + * See issue [#5695](https://github.com/angular/angular.js/issues/5695). |
| 1018 | + * |
| 1019 | + * #### Directives are not deduplicated before compilation |
| 1020 | + * |
| 1021 | + * When the original node and the replace template declare the same directive(s), they will be |
| 1022 | + * {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler |
| 1023 | + * does not deduplicate them. In many cases, this is not noticable, but e.g. {@link ngModel} will |
| 1024 | + * attach `$formatters` and `$parsers` twice. |
| 1025 | + * |
| 1026 | + * See issue [#2573](https://github.com/angular/angular.js/issues/2573). |
| 1027 | + * |
| 1028 | + * #### `transclude: element` in the replace template root can have |
| 1029 | + * unexpected effects |
| 1030 | + * |
| 1031 | + * When the replace template has a directive at the root node that uses |
| 1032 | + * {@link $compile#-transclude- `transclude: element`}, e.g. |
| 1033 | + * {@link ngIf} or {@link ngRepeat}, the DOM structure or scope inheritance can be incorrect. |
| 1034 | + * See the following issues: |
| 1035 | + * |
| 1036 | + * - Incorrect scope on replaced element: |
| 1037 | + * [#9837](https://github.com/angular/angular.js/issues/9837) |
| 1038 | + * - Different DOM between `template` and `templateUrl`: |
| 1039 | + * [#10612](https://github.com/angular/angular.js/issues/14326) |
986 | 1040 | *
|
987 | 1041 | */
|
988 | 1042 |
|
|
0 commit comments