Created
July 25, 2014 10:03
-
-
Save fesor/8a0d32d98091993030c3 to your computer and use it in GitHub Desktop.
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.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