Why is `replace` property deprecated in AngularJS directives?
angularjs, angularjs-directive, javascript
Solution
UPDATE
One of the collaborators has said it won't be removed, but known bugs will not be fixed. https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb#commitcomment-8124407
ORIGINAL
Here is the commit of this change: https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb
The `replace` flag for defining directives that replace the element that they are on will be removed in the next major angular version. This feature has difficult semantics (e.g. how attributes are merged) and leads to more problems compared to what it solves. Also, with WebComponents it is normal to have custom elements in the DOM.
It sounds to me like its a combination of complexity vs benefit to maintain support.
And apparently one reason dev were using it because they prefered semantically correct markup to be injected , thus replacing the custom directive tag.
Read the comments lower down on that link and apparently many people want it to stay.
Problem
According to the API docs, directives' `replace` attribute is deprecated, so in the future, all directives will behave with the current default of `replace: false`. This removes developers' ability to replace an element directive's element, with no apparent replacement for this functionality. See this plunk for an example of how element directives work with and without `replace: true`. Why is this useful attribute being deprecated with no replacement?