0
내가 input field
한 :Inprog 액션()
<input type="text" id="myId" ns-validate="" class="someClass" ng-model="Date" ng-
focus="focus($event, 'Parameters')" ng-blur="blur($event)" tabindex="-1">
포커스 이벤트가이 방법에 결합한다 : 나는 blur()
을 주석 경우
scope.focus = function (e, names) {
scope.dateSet = false;
$(e.currentTarget).blur();
$(e.currentTarget).prop('readonly', true).addClass('focus');
};
오류가 있지만 occures 없습니다 IE에서 읽기 전용 작업을 수행해야합니다.
이이이이 흐림 이벤트에 의해 발생할 수 있습니다이 방법에 결합되어scope.blur = function (e) {
$(e.currentTarget).prop('readonly', false).removeClass('focus');
};
그렇다면 크롬에서 IE 만도 실패한이 작업을하는 이유?
angular.module('xxx').directive('blurChecker', function() {
return function (scope, element, attributes) {
scope.$watch(attributes.blurChecker, function(){
element[0].blur();
})
};
});
더 효과
blurChecker='true'
를 HTML로 추가 : 의견 제안으로
내가이 지침을 만들려고. 어떤 아이디어?
HTML'ng-blur = "blur ($ element)"'JS :'scope.blur = function (ele) { ele.prop ('readonly', false) .removeClass ('focus'); }, ' –
작동하지 않습니다. 객체에는 prop가 없습니다 – szpic
다음 지시문을 사용하여 똑같은 작업을 수행하십시오. 그러면 DOM에서 더 나은 컨트롤러를 얻을 수 있습니다. –