Check this plunk...
the my-dir directive adds an ng-model directive bound to a new scope property and recompiles.
my-dir obviously removes itself's attribute to avoid infinite-loop.
It works well except for:
If the element has other directives (e.g. ng-click, in the plunk) it gets compiled twice, doubling it's effects.
Is there a way to "compile my-dir firsts and stop!", or wahtever to avoid the issue ?
            Asked
            
        
        
            Active
            
        
            Viewed 940 times
        
    1
            
            
         
    
    
        Khanh TO
        
- 48,509
- 13
- 99
- 115
 
    
    
        aleclofabbro
        
- 1,635
- 1
- 18
- 35
- 
                    2try `terminal: true` and `priority: 1000` on your directive, http://stackoverflow.com/questions/19224028/add-directives-from-directive-in-angularjs/19228302#19228302 – Khanh TO Jun 21 '14 at 08:38
- 
                    Yep! that's the way!! Thank you @Khahn TO – aleclofabbro Jun 21 '14 at 09:00