Angular Js File Upload - Uncaught SyntaxError: Unexpected token

时间:2017-12-18 07:52:24

标签: javascript angularjs

I want to upload image file using angular and php, but I am getting problem at app.service

error line : app.service('fileUpload', ['$https:', function ($https:) {

code

curl -H 'Authorization: Bearer <TOKEN>' \
     -H 'Accept-Language: en_US' \
     -H 'Content-Type: application/json' \
     -X DELETE \
     'https://api.uber.com/v1.2/requests/<REQUEST_ID>'

error

      app.service('fileUpload', ['$https:', function ($https:) {
        this.uploadFileToUrl = function(file, uploadUrl){
           var fd = new FormData();
           fd.append('file', file);

           $https:.post(uploadUrl, fd, {
              transformRequest: angular.identity,
              headers: {'Content-Type': undefined}
           })

           .success(function(){
           })

           .error(function(){
           });
        }
     }]);

1 个答案:

答案 0 :(得分:1)

change $('html, body').animate({ scrollTop: $(".responsiveView").offset().top }, 1000); to just $https:

$http