Created
January 31, 2014 02:49
-
-
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.
This file contains hidden or 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
<div ng-controller="AvatarController"> | |
<img ng-src="getImageUrl()" cloudinary open="imageDialogIsOpen" change="imageDidChange(url)"> | |
<button ng-click="openImageDialog()">Change Avatar</button> | |
</div> |
This file contains hidden or 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
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