Is it no longer possible to utilize Angular directives as what I like to refer to as "HTML decorators"?
I found this method extremely useful in Angular 1.x when transitioning legacy applications to Single Page Apps by creating a set of directives to enhance markup generated from the server. It seems like an oversight for the Angular Team to remove this capability.
An Example to Illustrate:
For instance, there is a jQuery plugin called chosen for enhanced select boxes. In Angular 1.x, I would typically do the following on a server-rendered page.
HTML:
<select chosen-select>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
JS
app.directive('chosenSelect', [
function() {
return {
restrict: 'AE',
link: function(scope, element, attributes) {
$(element).chosen();
}
};
}
]);
This code would effectively apply the chosen plugin to the server-generated HTML, requiring minimal changes apart from setting up ng-app. Is it still possible to achieve this type of directive in Angular 2+?
Thank you