Skip to content

Instantly share code, notes, and snippets.

@tatey
Created January 31, 2014 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatey/8725816 to your computer and use it in GitHub Desktop.
Save tatey/8725816 to your computer and use it in GitHub Desktop.
API I'd like to consume for uploading images to Cloudinary with AngularJS.
<div ng-controller="AvatarController">
<img ng-src="getImageUrl()" cloudinary open="imageDialogIsOpen" change="imageDidChange(url)">
<button ng-click="openImageDialog()">Change Avatar</button>
</div>
function AvatarController() {
this.member = Member.currentMember();
this.imageDialogIsOpen = false;
return this;
}
AvatarController.prototype.getImageUrl = function() {
return member.avatar_url;
};
AvatarController.prototype.openImageDialog = function() {
this.imageDialogIsOpen = true;
};
AvatarController.prototype.imageDidChange = function(url) {
member.avatar_url = url;
member.save();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment