0
私は角型でtypescirptを使用しています。角型の文字指令、要素内のdivを見つける
私はただのdiv含むテキストとクラス名が「ブロック-近い」私は閉じるボタンにクリック機能を追加する必要が
と閉じるボタンでディレクティブを作成しました。
ディレクティブ内にあるボタンにクリックイベントを追加するにはどうすればよいですか。私は
angular.element('.block-close').on('click', function(){
alert('here');
});
angular.element(document).find('.block-close').on('click', function(){
alert('here');
});
(()=>{
class MyDirective implements ng.IDirective{
public restrict = 'E';
public scope = {};
public controller = 'MyController';
public controllerAs = 'myCtrl';
public bindToController = true;
public templateUrl = "mysite.html";
constructor(){
}
link = (scope, element, attrs) => {
angular.element('.block-close').on('click', function(){
alert('here');
});
};
}
angular.module('myMod').directive('myDirective',()=> new MyDirective());
})();