Open uberspeck opened 9 years ago
This seems to fix it for me...feels sloppy though :(
angular
.module( "app.book" )
.controller( "NewBookCtrl", (FileUploader, api, ...) ->
vm = @
vm.record =
bookNumber: null
vm.uploader = new FileUploader(
url: "/book/upload/path"
alias: "bookFile"
formData: [vm.record]
queueLimit: 1
onAfterAddingFile: (item) ->
vm.record = item.formData[0] = {bookNumber: item._file.name.replace(".pdf","")}
...
)
return
)
Your fix would not work if you upload the file first and then change the form value.
On file upload I want to capture the file name and allow the user to update it before submitting (as a separate parameter (
bookNumber
) onformData
). I'm usingonAfterAddingFile()
to capture theitem._file.name
and set thebookNumber
. The$scope.bookNumber
value is bound correctly and theFileUploader.formData
also seems to be bound, but when I submit,bookNumber
is alwaysnull
. What am I missing?Screen shot of bindings all working as expected:
...and then, the request: