Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template
- .col-md-10.ngf-drop.pb-dropbox(ngf-select="", ngf-drop="", ng-model="file", accept="image/*", ngf-drop-available="dropAvailable", ngf-capture="'camera'", ngf-max-size="10MB", ngf-drag-over-class="{accept:'dragover', reject:'dragover-err', delay:100}")
- .col-xs-6
- img.img-circle.center-block(ng-hide="file", ng-src="{{img}}")
- img.img-circle.center-block(ng-show="file", ngf-src="file")
- input(type="hidden",name="imgurl",ng-model="imgurl")
- // p(ng-show="dropAvailable") or Drop File or Paste Image
- span.pb-progress(ng-show="file.progress >= 0")
- div(style="width:{{file.progress}}%",ng-bind="file.progress + '%'")
- span(ng-show="file.result") Upload Successful
- .col-xs-6
- .btn.btn-default.pull-right Select File
- controller
- $scope.$watch 'file', (file) ->
- Upload.upload
- url: 'http://pb-img.cloudapp.net:3000/upload'
- headers: 'optional-header': 'header-value'
- file: file
- .progress (evt) ->
- file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
- .success (data, status, headers, config) ->
- $scope.semaphore = false
- $timeout () ->
- $scope.imgurl = data.id
- file.result = data;
- .error (data, status, headers, config) ->
- alert('error status: ' + status)
Add Comment
Please, Sign In to add comment