我有一个输入框,可以接受在使用ng-disabled
输入正确值时立即禁用的字符然而,当我移动到下一个项目并上一个按钮时,页面会刷新
= 4)&&
我需要能够将问题的索引放入缓存
localStorage.setItem();
控制器:
$scope.initializeGame = function() {
$scope.score = (localStorage.getItem("token")) ? parseInt(localStorage.getItem("token")) : 0;
$scope.scoreValue = $scope.score
$scope.noOfTries = 0;
$scope.original = $scope.pageTitle;
$scope.guess = null;
$scope.deviation = null;
$scope.verifyGuess = function() {
$scope.deviation = $scope.original - $scope.guess;
$scope.noOfTries = $scope.noOfTries + 1;
$scope.falseAnswer = $scope.deviation != 0;
if ($scope.deviation == 0 && $scope.noOfTries == 1) {
$scope.scoreValue = parseInt($scope.score, 10) + 1;
var token = $scope.scoreValue;
localStorage.setItem("token", token);
};