Skip to content

Commit b1c4d12

Browse files
committed
I have my own service around $http. This service set special headers, and authorisation before get policy. So I cannot provide url. So I made that you have another option when you can set policy with you got as an object with your own request. The only problem for now is that the way you are dialing with attributes, is not 2 way and this parameter have to be resolved before assignment. That is ok for me because I use router ui and I can resolve things.
1 parent 0905c08 commit b1c4d12

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ attributes:
129129
* bucket - Specify the wanted bucket
130130
* s3-upload-options - Provide additional options:
131131
* getOptionsUri - The uri of the server service that is needed to sign the request (mentioned in section Setup#4) - Required if second option is empty.
132-
* getOptions - if for some reason you need to have your own mechanism of getting a policy, you can simply assign your scope variable to this option. Note it should be resolved on the moment of directive load.
132+
* getManualOptions - if for some reason you need to have your own mechanism of getting a policy, you can simply assign your scope variable to this option. Note it should be resolved on the moment of directive load.
133133
* folder - optional, specifies a folder inside the bucket the save the file to
134134
* enableValidation - optional, set to "false" in order to disable the field validation.
135135
* targetFilename - An optional attribute for the target filename. if provided the file will be renamed to the provided value instead of having the file original filename.

src/ng-s3upload/directives/s3-upload.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ angular.module('ngS3upload.directives', []).
3030
opts = angular.extend({
3131
submitOnChange: true,
3232
getOptionsUri: '/getS3Options',
33-
getOptions: null,
33+
getManualOptions: null,
3434
acl: 'public-read',
3535
uploadingKey: 'uploading',
3636
folder: '',
@@ -56,8 +56,8 @@ angular.module('ngS3upload.directives', []).
5656
var filename = selectedFile.name;
5757
var ext = filename.split('.').pop();
5858

59-
if(angular.isObject(opts.getOptions)) {
60-
_upload(opts.getOptions);
59+
if(angular.isObject(opts.getManualOptions)) {
60+
_upload(opts.getManualOptions);
6161
} else {
6262
S3Uploader.getUploadOptions(opts.getOptionsUri).then(function (s3Options) {
6363
_upload(s3Options);
@@ -66,7 +66,7 @@ angular.module('ngS3upload.directives', []).
6666
});
6767
}
6868

69-
function _upload(){
69+
function _upload(s3Options){
7070
if (opts.enableValidation) {
7171
ngModel.$setValidity('uploading', false);
7272
}

0 commit comments

Comments
 (0)