I have the following code:
Arduino
Only on Safari I get the following error:
$http.post(constants.path+'address.php', {form}).then(function(data){
console.log(data);
console.log("success");
});
}
Every other browser don't complain about this code. Any ideas ?
EDIT 1: The whole function is:
'SyntaxError: Unexpected token '}'. Expected a ':' following the property name 'form'.
This is a service function to send data to my backend
EDIT2: Just for future reference, removing the {} created the problem that my backend was expecting to receive a function enviaVaga(form){
console.log(form);
return $http.post(constants.path+'json.php', {form}).then(function(data){
console.log(data);
console.log("sucesso");
});
}
object on form
, to solve this I use $formData
, that works well on Safari.
答案 0 :(得分:3)
You aren't passing anything valid for setCurrentTabByTag()
. Safari is attempting to interpret data
as a new object.
Other browsers may be more gracious, but just drop the {form}
and {
.
Actually, other browser might be interpreting }
as object short notation which is not supported by safari. see: https://kangax.github.io/compat-table/es6/#object_literal_extensions