@@ -459,19 +459,16 @@ In that case, it is necessary to intercept the *initial* compilation of the elem
459
459
1. Give your directive the `terminal` property and a higher priority than directives
460
460
that should not be compiled twice. In the example, the compiler will only compile directives
461
461
which have a priority of 100 or higher.
462
- 2. Inside this directive's compile function, remove the original directive attribute from the element,
463
- and add any other directive attributes. Removing the attribute is necessary, because otherwise the
464
- compilation would result in an infinite loop.
465
- 3. Compile the element but restrict the maximum priority, so that any already compiled directives
466
- are not compiled twice.
462
+ 2. Inside this directive's compile function, add any other directive attributes to the template.
463
+ 3. Compile the element, but restrict the maximum priority, so that any already compiled directives
464
+ (including the `addOptions` directive) are not compiled again.
467
465
4. In the link function, link the compiled element with the element's scope
468
466
469
467
```
470
468
angular.module('app').directive('addOptions', function($compile) {
471
469
return {
472
470
priority: 100, // ngModel has priority 1
473
471
terminal: true,
474
- template: '<input ng-model="$ctrl.value">',
475
472
compile: function(templateElement, templateAttributes) {
476
473
templateAttributes.$set('ngModelOptions', '{debounce: 1000}');
477
474
0 commit comments