I'm working with a PhP interface. I must interact with this interface to save some data. For instance, to save a Customer, the PhP service wants the data through a POST request in this form
- customer[customer_name] = "name of the customer"
- customer[customer_code] = "code of the customer"
- customer[customer_is_visible] = "whether or not the customer is visible"
I tried to create an AngularJS service to do that:
angular.module("app").factory("SaveCustomer", ["$resource",
function($resource){
return $resource("/services/customers/post/",
{
customer[customer_name]:'@name',
customer[customer_code]:'@code',
customer[customer_is_visible]:'@visibility',
dtsave:'true'
},
{
save: {
method:'POST'
}
});
}]);
The problem is about the parameters name. Angular doesn't like the square bracket and it says: "Expected : but found [ in customer[custom ..." Can I achieve this task or do I have to modify the PhP interface to interact with? (note that the interface has not been created by me). Thank you.
EDIT: I call the service this way:
SaveCustomer.save({name:customerName, code:customerCode, visibility:customerIsVisible});