angularjs“你好世界”指令+ coffeescript无法正常工作

时间:2014-05-26 02:55:38

标签: angularjs

假设我的指令在

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

并在directive.coffee中

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

的index.html:

<span showAuthorLogin></span>

为什么没有任何显示?

1 个答案:

答案 0 :(得分:1)

restrict: 'E'表示该指令必须是一个元素。因此,您可以将指令更改为restrict: 'A',或者您可以将html更改为:<showAuthorLogin></showAuthorLogin>

以下是一个关于JSFiddle的示例:http://jsfiddle.net/X6A7M/

相关问题