A Simple Uploader using AngularJs (with CORS Implementation)

后端 未结 1 1608
攒了一身酷
攒了一身酷 2021-01-29 02:44

Recently, I had to write a simple uploader (reusable) using AngularJs, while, keeping my API in separate place and finally wrote one using blueimp jQuery File Uploader and made

1条回答
  •  我在风中等你
    2021-01-29 03:41

    http://codelikeapoem.com/2013/05/angularjs-tutorial-4-file-upload-using.html (You can download the entire code their)

    App.Coffee

    @angTut = angular.module("angTut", ['LocalStorageModule', 'ngResource', 'uploaderComponent']);
    
    @angTut.constant('uploadServiceUrl', 'http://192.168.0.2/api/index.php')
    

    todos_uploader_controller.coffee

    "use strict"
    @angTut.controller('TodosUploadController', (
    $scope, uploadService
    ) ->
    
    $scope.uploadLayer = (e, data, process) ->
        $scope.uploadReturn = uploadService.process(e, data, process)
        $scope.uploadReturn = uploadService.initialize() 
    )
    

    uploader.directive

    https://gist.github.com/sk8terboi87/5652187

    upload.html

        
    {{uploadReturn.message}}

    File: {{uploadReturn.successData.name}}

    View file

    0 讨论(0)
提交回复
热议问题