토글이 선택되었을 때 사용자에게 액세스 권한을 부여하기 위해 내 응용 프로그램에서 ionic 토글을 사용하고 있습니다. DB에서 권한 상태가 변경됩니다. 그러나 응용 프로그램이 닫히고 다시 열렸을 때 토글 됨이 해제되어 있지만 DB에서 변경된 액세스 권한은 변경된 상태로 유지됩니다. 나는 토글을 체크 온 상태로 유지하려고했지만 제대로 액세스 할 수 없었습니다. 따라서 앱이 다시 열릴 때마다 토글을 체크 온 상태로 유지하는 데 도움이 필요합니다. 따라서 액세스 권한이 부여 된 사용자를 알 수 있습니다.angularjs에서 토글 사용
토글을 체크 아웃하면 권한이 '액세스 권한 없음'으로 자동 변경됩니까?
HTML :
<ion-toggle ng-model="numbers.checked" ng-repeat="numbers in phoneList" ng-change="change(numbers)" toggle-class="toggle-positive">
{{numbers.userId}}
</ion-toggle>
컨트롤러 :
$scope.change= function (obj) {
$scope.userId=obj._id;
console.log($scope.userId);
var UpdateRole={'_id':$scope.userId,'role':'permit'};
adminService.accessAdminPhone(UpdateRole,function(err,response){
console.log('Passed thro Controller');
console.log(UpdateRole);
});
서비스 :
var UpdateAdminAccess = function (UpdateRole,callback) {
$http({
method:'POST',
url: urlEdit + 'auth/accessPermission',
data: UpdateRole
}).success(function (data, response, headers, config) {
callback(response);
console.log("successfully updated");
}).error(function(data,status,error, headers,config){
callback(error);
console.log(status);
console.log(data);
})
};
adminAccess.accessAdminPhone= UpdateAdminAccess;
return adminAccess;
});
그래서 당신의 문제는 귀하의 데이터베이스에 있습니다 ....보기는 귀하의 애플 리케이션을 다시 열기에 보여주는 것입니다 –
예 @SaEChowdary – Rudhra