SHARE
TWEET

Untitled

a guest Jan 15th, 2016 8 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. I am trying to post data like this using AngularJS with FormData.
  2.  
  3. data = {
  4.     'album_name': 'The Grey Album',
  5.     'artist': 'Danger Mouse',
  6.     'tracks': [
  7.         {'order': 1, 'title': 'Public Service Announcement', 'duration': 245, 'thumbnail' : 'image1filehere'},
  8.         {'order': 2, 'title': 'What More Can I Say', 'duration': 264, , 'thumbnail' : 'image2filehere'},
  9.         {'order': 3, 'title': 'Encore', 'duration': 159, 'thumbnail' : 'image3filehere'},
  10.     ],
  11. }
  12.  
  13. But its converting the array to string as shown below, but I want the it as shown above.
  14. data = {
  15.     'album_name': 'The Grey Album',
  16.     'artist': 'Danger Mouse',
  17.     'tracks': "[
  18.         {'order': 1, 'title': 'Public Service Announcement', 'duration': 245, 'thumbnail' : 'image1filehere'},
  19.         {'order': 2, 'title': 'What More Can I Say', 'duration': 264, , 'thumbnail' : 'image2filehere'},
  20.         {'order': 3, 'title': 'Encore', 'duration': 159, 'thumbnail' : 'image3filehere'},
  21.     ]",
  22. }
  23.  
  24. How to achieve that using AngularJS. Which form type should I use for this. Form Data or any other ?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top