passman/js/app/services/settingsservice.js
2016-09-15 21:21:34 +02:00

31 lines
697 B
JavaScript

'use strict';
/**
* @ngdoc service
* @name passmanApp.SettingsService
* @description
* # SettingsService
* Service in the passmanApp.
*/
angular.module('passmanApp')
.service('SettingsService', ['localStorageService', function (localStorageService) {
var settings = {
defaultVault: null,
defaultVaultPassword: null
};
var cookie = localStorageService.get('settings');
settings = angular.merge(settings, cookie);
return {
getSettings: function(){
return settings
},
getSetting: function(name){
return settings[name]
},
setSetting: function (name, value) {
settings[name] = value;
localStorageService.set('settings', settings);
}
}
}]);