Assuming I have a directive \"mydirect\" with a template that contains a lot of divs with a lot of nested classes. For example:
Its much easier to use actual element names to create directives in your DOM rather than trying to use the class method. For two reasons: 1) its much more readable to have Leave your directive just the way it is, except change it to Here are the options you can now use and how to configure the corresponding CSS to get the styles you want, as shown in this jsbin: Hope that helps.
vs restrict: 'EA'
(docs for that here) and replace: false
, as shown here:.directive('mydirect', function() {
return {
restrict: 'EA',
replace: false,
template: '-All that Html here-'
};
});