server.service.js 668 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @fileOverview
  3. *
  4. * 与后端交互的服务
  5. *
  6. * @author: zhangbobell
  7. * @email : zhangbobell@163.com
  8. *
  9. * @copyright: Baidu FEX, 2015
  10. */
  11. angular.module('kityminderEditor')
  12. .service('server', ['config', '$http', function(config, $http) {
  13. return {
  14. uploadImage: function(file) {
  15. var url = config.get('imageUpload');
  16. var fd = new FormData();
  17. fd.append('upload_file', file);
  18. return $http.post(url, fd, {
  19. transformRequest: angular.identity,
  20. headers: {'Content-Type': undefined}
  21. });
  22. }
  23. }
  24. }]);