ディレクティブを使用し、コンテンツをトランスクルードし、トランスクルードされた部分内でディレクティブのコントローラー メソッドを呼び出したい:
<mydirective>
<div ng-click='foo()'>
click me
</div>
</mydirective>
app.directive "mydirective", ->
return {
restrict: 'EACM',
transclude: true
template: "<div ng-transclude></div>"
scope: { } #required: I use two way binding on some variable, but it's not the question here
controller: [ '$scope', ($scope)->
$scope.foo = -> console.log('foo')
]
}
どうすればそれができますか?