【发布时间】:2023-03-26 14:14:01
【问题描述】:
我对这个指令定义对象 - (restrict) 感到困惑。
我创建了两个函数,一个是带restrict的,另一个是不带restrict的。
当我运行这段代码时,两个指令都返回了相同的结果。
与 restrict:
app.directive 'helloWorld', ->
return {
restrict: 'AE'
link: (scope, elem, attrs) ->
console.log "HELLO WORLD"
}
没有 restrict:
app.directive 'helloWorld', ->
return {
link: (scope, elem, attrs) ->
console.log "HELLO WORLD"
}
谁能告诉我这里发生了什么? PS:我是角度的新手。请,如果您能帮助我,我们将不胜感激。
【问题讨论】:
标签: javascript angularjs coffeescript