Click here to Skip to main content
15,905,877 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Could you please help me on the FileUplaod by using Angularjs2 version

What I have tried:

I have searched in google but all are related to angularjs 1 version..Not able to find the Angularjs2 version for Fileupload.
Posted
Updated 29-Jan-17 23:38pm
Comments
Afzaal Ahmad Zeeshan 27-Jan-17 11:49am    
There are a lot of article already available on the Internet for this. Try finding it on Google or start at the top right corner of this website.

 
Share this answer
 
The below cade is working for Angularjs 1 but i am not able to findout the proper code for angularjs2
<script type="text/javascript">
    var app = angular.module('myApp', ['lr.upload']);

    app.controller('HomeCtrl', ['$scope', 'upload', '$http', function ($scope, upload, $http) {
       
        $scope.doUpload = function () {

            upload({
                url: 'Home/upload',
                method: 'POST',
                data: {
                    aFile: $scope.myFile
                }
            }).then(
              function (response) {
                  console.log(response.data);
              },
              function (response) {
                  console.error(response);
              }
            );

        }


    } ])
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900