Below is a snippet of my Javascript code.
app.controller('RegisterCtrl', function($scope, $cookies) {
$scope.registerInfo = {};
if($cookies.registerInfo){
angular.forEach($cookies.registerInfo, function(value, key) {
$scope.registerInfo[key] = value;
});
}
$scope.preserve = function() {
$cookies.registerInfo = new Map();
angular.forEach($scope.registerInfo, function(value, key) {
$cookies.registerInfo.set(key, value);
});
};
I have already implemented the corresponding HTML which is shown below.
<input type="number" ng-model="registerInfo.lunch_budget_from">
<input type="number" ng-model="registerInfo.lunch_budget_to">
<button ng-click="preserve();">
The issue I am facing is that I intended to store data as a Map on cookies, but '$cookies.registerInfo' seems to be saved as a String instead and I cannot retrieve the values accurately...