Skip to content

Instantly share code, notes, and snippets.

@fesor
Created July 25, 2014 10:03
Show Gist options
  • Save fesor/8a0d32d98091993030c3 to your computer and use it in GitHub Desktop.
Save fesor/8a0d32d98091993030c3 to your computer and use it in GitHub Desktop.
app.factory('Slide', [ function () {
function Slide(blockData) {
this.data = angular.extend({}, blockData || {});
this.uploadInfo = {};
this.uploadOptions = {
fieldName: 'asset[attachment]' // может это дело в конструктор передавать? это ж настройки по идее...
change: angular.bind(this, this.cangeHandler)
};
}
Slide.prototype = {
setData: function (blockData) {
angular.extend(this, blockData);
},
changeHandler: function (file) {
file.$upload('/asset_upload/slide-image.json', this.uploadInfo).then(
function (aa) {
alert(Object.keys(aa.data).join(','));
}, function (aa) {
alert(Object.keys(aa.data).join(','));
});
}
};
return Slide;
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment