1
私は私の指示に次のコードを持っている:html ng-clickからリンク関数メソッドを呼び出す方法は?
testModule.directive('TestOne',function(){
return{
replace: true,
controller: 'TestCtrl',
link: function(scope, element, attrs){
element.on('click', function(e) {
//my own code is there
});
}
}
}
私は(=「)(MyTestには」NGクリック)HTMLで、以下のイベントでNGクリックで上記のクリック機能を呼び出すために望んでいました。上記のディレクティブの要素クリック機能で自分の関数要件を自分の要件に従って実行できるように、どうやって呼び出すか、正確に書くことができますか?
HTML:事前に
<div test-one ng-repeat="items in testjson">
<div class="title">{{items.name}}</div>
<div class="context-menu">
<ul>
<li ng-click="mytest()">TestFunction</li>
</ul>
</div>
</div>
感謝。