Skip to content

Instantly share code, notes, and snippets.

@JonathanZWhite
Last active August 29, 2015 14:17
Show Gist options
  • Save JonathanZWhite/f08e920c66267fd8af57 to your computer and use it in GitHub Desktop.
Save JonathanZWhite/f08e920c66267fd8af57 to your computer and use it in GitHub Desktop.
(function() {
'use strict';
ThemeController.$inject = ['$scope', 'Notifications'];
function ThemeController($scope, Notifications) {
$scope.user = {};
$scope.changeTheme = function(theme) {
$scope.user.theme = theme;
};
$scope.saveChanges = function() {
$http.put('/user/save', $scope.user)
.success(function() {
Notifications.showSuccess();
})
.error(function() {
Notifications.showError();
});
};
$http.get('/user')
.success(function(data) {
$scope.user = data;
Notifications.showSuccess();
})
.error(function(err) {
Notifications.showError();
});
}
angular
.module('themes', [])
.controller('ThemeController', ThemeController);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment