0
확인란을 포함 시켰습니다. 확인란을 클릭하면 경고 팝업이 표시됩니다. 알리미 팝업창에서 확인을 클릭하면 체크 박스를 완전히 대체하고 대신 그 사실을 유지해야합니다.Angular JS, alert true 또는 false
Angular JS에서 어떻게 표시 할 수 있습니까?
JS 내가 사용하고
angular.module('app', [])
.controller('alertsMesssageCtrl', ['$scope', function($scope) {
$scope.alert = {
alertType: false //initialization
};
$scope.onAlertChange = function() {
var box = confirm("Are you sure you want to do this?");
if (box === false) { // no
$scope.alert.alertType = !$scope.alert.alertType; //revert
}else{ //yes sure
}
};
});
HTML
<div ng-app="app" ng-controller="alertsMesssageCtrl">
<input type="checkbox" ng-model="alert.alertType" ng-change="onAlertChange()" />
</div>
참고 :
angular.module('app', [])
.controller('alertsMesssageCtrl', ['$scope', function($scope) {
$scope.onalertClick = function(alert) {
var box = confirm("Are you sure you want to do this?");
if (box === false) { // yes sure
alert.alertType = !alert.alertType;
return true;
}else{
}
};
달성하려는 목표는 무엇입니까? 귀하의 질문은 분명하지 않습니다. – Ronnie