Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 - Form Data [duplicate]

I'm the only one who gets the empty formData {} after making an append I'm working with angular 2 the latest version.

let formData: FormData = new FormData()
   formData.append('key','value')
   console.log(formData)

Result:

FormData { }
like image 560
Jansen Moscol Avatar asked Mar 03 '17 23:03

Jansen Moscol


1 Answers

FormData is not plain js object, API link: https://developer.mozilla.org/ru/docs/Web/API/FormData

let data = new FormData();
data.append('key', 'value');
console.log(data.get('key'))
like image 128
kemsky Avatar answered Sep 29 '22 15:09

kemsky