0

assume I have my directives in

@directivesModule = angular.module('myApp.directives', [])

and in directive.coffee

directivesModule.directive 'showAuthorLogin', () ->
    restrict: 'E'
    template: '<div>Hello World</div>'

index.html:

<span showAuthorLogin></span>

why isn't anything showing?

4
  • what does the compiled javascript look like? Commented May 27, 2014 at 0:49
  • looks like this on jsfiddle jsfiddle.net/CXgw7 Commented May 27, 2014 at 1:47
  • ah your html needs to be <span show-author-login></span> . Angular converts it from camel case. I posted an example in my answer Commented May 27, 2014 at 2:26
  • thanks, didn't expect that Commented May 27, 2014 at 3:26

1 Answer 1

1

restrict: 'E' means that the directive has to be an element. So you could change the directive to restrict: 'A' or you could change your html to: <showAuthorLogin></showAuthorLogin>

Here is an example of it working on JSFiddle: http://jsfiddle.net/X6A7M/

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.