-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
documentation #458
Comments
I am planning to create a website page with better doc format when I get time. |
|
angular-file-upload version 2.0.5 Another issue: you use ng-accept in your demo html, yet it is undocumented When I look at the demo code for:
This is what is displayed:
Where does the variable 'file' come from in the line:
For that matter, where does $upload come from? |
Okay, I got the following to work: html:
app.js:
|
@danialfarid @7stud - I am having the same problem - the documentation is incomplete, the very first thing you see as a developer is a variable called |
@7stud - is jQuery 2.1.1 a required dependency? |
When you use @brianfeister what undefined variable |
@brianfeister It is a required dependency for Bootstrap which he uses. I do not believe it is required for angular-fileupload though. |
@driek What parts of the docs is confusing? Feel free to contribute to the docs but I would keep it minimum since too much seems too complicated. |
@danialfarid For example, I see everywhere
What is the reason for putting a reference in the scope variable? It was not clear whether the file is being uploaded already or that some method has to be invoked on this $scope.upload. <button|div|input type="file"|ng-file-select|...
ng-file-select ng-model="myFiles" // binds the selected files to the scope model
ng-file-change="fileSelected($files, $event)" // will be called upon files being selected
// you can use $scope.$watch('myFiles') instead
ng-multiple="true|false" // default false, allows selecting multiple files
accept="image/*,*.pdf,*.xml" // see standard HTML file input accept attribute
resetOnClick="true|false" // default true, reset the value to null and clear selected files when
// user cancels file select popup. (default behaviour in Chrome)
>Upload</button> Also you mentioned that At the demo page, you have created some very useful elements and how it can be used in the real world, however, again we are missing code. The HTML part seems to be OK but it is the JavaScript code that is lacking. (I would like know how to implement a simple file selection with Thumbnail generation and a submit button. Only when the submit button is clicked, the picture should be uploaded. But it was very hard for me to find out how to make the JS side of it.) var data = $scope.formUpload ? {
username: $scope.username
} : {};
file.upload = $upload.upload({
url: 'https://angular-file-upload-cors-srv.appspot.com/upload' + $scope.getReqParams(),
method: 'POST',
headers: {
'my-header' : 'my-header-value'
},
data: data,
file: file,
fileFormDataName: 'myFile',
});
file.upload.then(function(response) {
$timeout(function() {
file.result = response.data;
});
}, function(response) {
if (response.status > 0)
$scope.errorMsg = response.status + ': ' + response.data;
});
file.upload.progress(function(evt) {
// Math.min is to fix IE which reports 200% sometimes
file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
});
file.upload.xhr(function(xhr) {
// xhr.upload.addEventListener('abort', function(){console.log('abort complete')}, false);
}); However, it is unclear where this If you have time, please also take a look on my bug report. (it is rather a question than a bug maybe, but still..) |
@driek thanks for the detailed response, I will work on improving those. |
Thanks also for spelling it out @driek - that is an accurate summary of my thoughts as well. |
The missing piece is that the code is actually wrapped by this function in your demo, which is left out of the documentation/explanation. It declares the 'file' variable.
|
@clabough I added that feature to the demo page to be able to dynamically modify the upload script so it would actually cal |
Yes, I figured that was the case. I just wanted to note here where it was coming from. |
I have updated the documentation and sample a lot in version 3.0.0. |
I have implemented as follows I'm getting the file attributes from my directive. But am getting an error when I submit is as follows ReferenceError: Upload is not defined Can you please help me on this |
Inject Upload and ngFileUpload dependencies to your app and controller. See the jsfiddle and docs samples. |
The documentation is terrible. If you can't document what you created, then you didn't create anything of value to anyone else. What is the following garbled mess supposed to mean:
ng-file-change does nothing for me. The only thing that works for me is:
<input type="file" ng-file-select="doSomething($files)">
Where is that documented?
Chrome Version 39.0.2171.95 (64-bit)
The text was updated successfully, but these errors were encountered: