angularjs service to synchronize any variable with localStorage