다음과 같은 문제가 있습니다.각도 지시문 및 범위
내보기
<a class="btn btn-hero" confirmation-download-all
ng-if="downloadPackageLink"><i class="fa fa-download" aria-hidden="true"></i> {{signDocumentDownloadAllButton}}</a>
에 다음 코드를하고 난 지시어를 가지고
function confirmationDownloadAll(deviceDetector) {
return {
restrict : 'A',
priority : 1,
terminal : true,
scope : {
signDocumentDownloadAllButton : '=',
},
link : function (scope, element, attr) {
var clickAction = attr.ngClick;
element.bind('click', function (event) {
event.preventDefault();
if (scope.deviceDetector.os == 'ios') {
var sweetOptions = {
title : scope.signDocumentDownloadAllNotificationTitleIOS,
text : scope.signDocumentDownloadAllNotificationMessageIOS,
type : "warning",
showCancelButton : false,
confirmButtonColor : "#DD6B55",
confirmButtonText : scope.signDocumentDownloadAllButton,
closeOnConfirm : true
};
swal(sweetOptions,
function (isConfirm) {
if (isConfirm) {
var downloadall = document.getElementById('hidden_downloadall');
downloadall.click();
//if (sweetConfirmOption) swal(sweetConfirmOption);
//if (attrs.sweetOnConfirm) scope.$evalAsync(attrs.sweetOnConfirm);
}
});
} else {
var downloadall = document.getElementById('hidden_downloadall');
downloadall.click();
}
});
}
};
}
그리고 내 문제는 내보기에, 버튼의 텍스트를 보여주는 대신, {{signDocumentDownloadAllButton}}
때문이다 $scope. signDocumentDownloadAllButton
나는 매우 단순해야한다고 생각하지만 나는 열망하고 있습니다.
어디에서 'scope.deviceDetector'를 가져 오나요? 당신은'scope' 블록의 일부로 그것을 나열하지 않습니다. – Makoto
jsfiddle [여기] (https://jsfiddle.net/cLe9kxd4/16/)에 코드를 두었고 많은 오류가있었습니다. deviceDetectotr은 서비스가 아닙니다. scope.deviceDetector와 왜 관련이 있는지 이해하지 못했습니다. 나는 그것을 제거했지만 작동하지 않았다. 콘솔에 오류가 있습니까? –