0

I have a directive <my-directive> that is an element. I do not use link or compile, just:

export default function myDirective() {
    return {
        restrict: 'E',
        scope: true,
        templateUrl: 'my-directive.html',
        controller: mydirective,
        controllerAs: 'mine',
        bindToController: {}
    }
}

This of course is a fake directive, but the issue I have is being able to add a css class on this directive when it is in the DOM.

if there is anymore information I need to add, please let me know.

1
  • Why won't <my-directive class="someClass"></my-directive> work? Commented May 13, 2016 at 15:27

1 Answer 1

2

You could target the directive's tag from your CSS/scss stylesheet, this way:

Say you have:

<mydirect></mydirect>

So in styles.css:

mydirect {
  background-color: red;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.