Skip to content

Instantly share code, notes, and snippets.

@daslicht
Created June 4, 2014 12:33
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 daslicht/ddcc14ef86f5c4bdddd2 to your computer and use it in GitHub Desktop.
Save daslicht/ddcc14ef86f5c4bdddd2 to your computer and use it in GitHub Desktop.
app.factory('uploadImage', function() {
var url = "/images";
function uploadFiles(fileList,callback){
...
}
function init(item){
$(item).editable({
inlineMode: true,
beforeFileUploadCallback: function (files) {
console.log(files);
uploadFiles(files,function(url){
$(item).editable("writeImage", url);
console.log('done url: ',url);
});
return false;
}
});
}
return function(item){
init(item);
}
});
app.controller('Controller', function ($scope, $templateCache, uploadImage) {
$scope.master = {};
$scope.show = function(){ //append
var item = $templateCache.get('templateId.html');
console.log(item);
$('#formContainer').append(item);
uploadImage(item);
/*initialize wysiwyg editor, how do i get the proper added item here in order to attach the wysiwyg editor to it ?*/
}
$scope.reset();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment