Created
September 12, 2016 16:28
-
-
Save unicodeveloper/3eebd79f2f242419c9a97398675d58f7 to your computer and use it in GitHub Desktop.
Cloudinary Blog Post - Part 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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