angular.js - How to encapsulate upload in angularjs
黄舟
黄舟 2017-05-15 17:09:10
0
1
483

Currently my method of uploading images is written separately. Here is an example, the following code:

Now I want to merge this upload into a method, write it in a public method, and call it directly in the controller,

However, the current problem is that each url and data take the interface address and current parameters of the current service. How do I merge the code and call it?

Please let me know, thank you~

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
漂亮男人

Just an idea, write a service, inject the upload plug-in dependency, and inside it is your $upload.upload method, which returns the formatted data.
In other places, you only need to call this service and pass the current URL as a parameter

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template