Skip to content
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

only change query option data not trigger http request #340

Open
fantaishao opened this issue Jan 10, 2018 · 0 comments
Open

only change query option data not trigger http request #340

fantaishao opened this issue Jan 10, 2018 · 0 comments

Comments

@fantaishao
Copy link

fantaishao commented Jan 10, 2018

In my project , I put some additional parameters in the query options.
These query options can be changed by the user .

After uploading a file successfully, I only change the query options and keep the image file uploaded just now , and then I want to save it. But the http request is not triggered.

     $scope.flowInitOptions = {
         target: 'api/upload/pic',
         query: function(flowFile, flowChunk) {
           return $scope.initParams;
         },
         forceChunkSize: true,
         singleFile: true,
         testChunks: false,
         uploadMethod: 'POST',
         headers: getHeaders(),
         generateUniqueIdentifier: UUID.generate,
         permanentErrors: [400, 404, 415, 500, 501,401]
       };
    $scope.save = function($file, $event, $flow, type) {
         $flow.opts.query = angular.copy($scope.initParams);
         $flow.opts.query.publishDate = $scope.formatTime(angular.copy($scope.initParams.publishDate),'YYYY-MM-DD','');
         $flow.opts.query.scanEndDate = $scope.formatTime(angular.copy($scope.initParams.scanEndDate),'YYYY-MM-DD','');
         $flow.opts.query.scanStartDate = $scope.formatTime(angular.copy($scope.initParams.scanStartDate),'YYYY-MM-DD','');
         $flow.opts.query.articleClassifyId = angular.copy($scope.initParams.articleClassify.id);
         $flow.opts.query.classifyFlag = angular.copy($scope.initParams.classifyFlagTmp)?1:0;
         $flow.opts.query.scanType = angular.copy($scope.initParams.scanTypeTmp)?1:0;
         $flow.opts.query.useWebLib = angular.copy($scope.initParams.useWebLibTmp)?1:0;
         if(type == 'retry') {
           $flow.files[0].retry();
         }else {
           $flow.upload();
         }
       };
<div class="add-img-library add-work-library" ng-controller="AddImgLibraryController"
   flow-init="flowInitOptions"
   flow-file-added="!!{png:1,gif:1,jpg:1,jpeg:1}[$file.getExtension()];someHandlerMethod($file, $event, $flow)"
   flow-file-success="saveSuccess( $file, $message, $flow )"
   flow-complete="infoComplete( $file, $message, $flow )"
   flow-file-error="saveError( $file, $message, $flow )">
</div>

is there a cleaner way, I can trigger the http request right when I only change the query option,but don't change the text file or img file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant