这就是我希望这样做的方式,例如,如果你在短时间内关闭一个弹出窗口2天,例如1或2,它就不应该再这样做了直到190天。
var app = angular.module('PopUpUsers', []);
app.controller('ViewPopUp', ['$scope', '$timeout', function ($scope, $timeout) {
$timeout(function () {
$scope.PopUpViewDiv = true;
}, 12500);
$scope.ClosePopUp = function () {
$scope.PopUpViewDiv = false;
};
}]);
我认为我现在必须忽略这一点,这与您点击近距离并以某种形式的饼干记住它的次数相反。
问题只是:我如何完成以便他们能够记住弹出窗口关闭了多少次?
更新代码:
var app = angular.module('PopUpUsers', []);
app.controller('ViewPopUp', ['$scope', '$timeout', '$cookies', function ($scope, $timeout, $cookies) {
var cookieWObject = $cookies.getObject('test');
var count = 3;
if (cookieWObject == count) {
$scope.PopUpViewDiv = false;
} else {
$timeout(function() {
$scope.PopUpViewDiv = true;
}, 12500);
$scope.ClosePopUp = function () {
$scope.PopUpViewDiv = false;
$cookies.putObject("test", count);
};
}
}]);