Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Created September 12, 2016 16:28
Show Gist options
  • Save unicodeveloper/3eebd79f2f242419c9a97398675d58f7 to your computer and use it in GitHub Desktop.
Save unicodeveloper/3eebd79f2f242419c9a97398675d58f7 to your computer and use it in GitHub Desktop.
Cloudinary Blog Post - Part 1
app.controller('ProfileController', ['$scope','$http','toastr','User', function($scope, $http, toastr, User) {
$scope.getProfile = function() {
User.getProfile()
.then(function(response) {
$scope.user = response.data;
})
.catch(function(response) {
toastr.error(response.data.message);
});
};
$scope.updateProfile = function() {
User.updateProfile($scope.user)
.then(function() {
toastr.success('Profile has been updated!');
})
.catch(function(response) {
toastr.error(response.data.message);
});
};
$scope.getProfile();
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment