, .
1 - $scope
AngularJS , index.HTML, . $scope. . :
index.html
<body ng-controller="DefaultController">
DefaultController.js:
angular.module('YourModule').controller('DefaultController', ['$scope', function ($scope) {
$scope.isChecked = true;
}]);
YourCheckBoxController.js
angular.module('YourModule').controller('YourCheckBoxController', ['$scope', function ($scope) {
$scope.accessingTheVariable= function () {
if ($scope.isChecked) {
}
else {
}
};
$scope.onCheckBoxToggle {
$scope.isChecked = _this.uiChoices.selectAll;
};
}]);
2- localStorage
if (localStorage.hasOwnProperty("isChecked")) {
if(localStorage.isChecked) {
}
else {
}
}
localStorage.setItem("isChecked", _this.uiChoices.selectAll);
3 - Angular (Factory)
, (, 1 ). :
YourService.js
angular.module('YouModule').factory('YouService', function () {
var data =
{
IsChecked = true
};
data.buildIsChecked = function (isChecked) {
this.IsChecked = isChecked;
};
return data;
});
YourIsCheckedController.js:
angular.module('YourModule').controller('YourCheckBoxController',
['$scope', 'YouService', function ($scope, YouService) {
YouService.buildIsChecked(_this.uiChoices.selectAll);
var isChecked = MenuService.IsChecked;
}]);