Skip to content

Commit

Permalink
I have my own service around $http. This service set special header…
Browse files Browse the repository at this point in the history
…s, 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.
  • Loading branch information
Serhioromano committed Jan 4, 2015
1 parent 0905c08 commit b1c4d12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ attributes:
* bucket - Specify the wanted bucket
* s3-upload-options - Provide additional options:
* 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.
* 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.
* 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.
* folder - optional, specifies a folder inside the bucket the save the file to
* enableValidation - optional, set to "false" in order to disable the field validation.
* 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.
Expand Down
8 changes: 4 additions & 4 deletions src/ng-s3upload/directives/s3-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ angular.module('ngS3upload.directives', []).
opts = angular.extend({
submitOnChange: true,
getOptionsUri: '/getS3Options',
getOptions: null,
getManualOptions: null,
acl: 'public-read',
uploadingKey: 'uploading',
folder: '',
Expand All @@ -56,8 +56,8 @@ angular.module('ngS3upload.directives', []).
var filename = selectedFile.name;
var ext = filename.split('.').pop();

if(angular.isObject(opts.getOptions)) {
_upload(opts.getOptions);
if(angular.isObject(opts.getManualOptions)) {
_upload(opts.getManualOptions);
} else {
S3Uploader.getUploadOptions(opts.getOptionsUri).then(function (s3Options) {
_upload(s3Options);
Expand All @@ -66,7 +66,7 @@ angular.module('ngS3upload.directives', []).
});
}

function _upload(){
function _upload(s3Options){
if (opts.enableValidation) {
ngModel.$setValidity('uploading', false);
}
Expand Down

0 comments on commit b1c4d12

Please sign in to comment.