0
각도로 typescirpt를 사용하고 있습니다.각 타이프 스크립트 지시문, 요소 링크 내부에서 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());
})();