Reputation: 29
My goal is to create an http post method in the service that gets the following parameters from the controller: id, firstname,lastname,email,phonenumber ,in the controller:
function updateClient(client){
var clientId=client.id;
var firstName=$("#clientFirstName");
var lastName=$("#clientLastName");
var email=$("#clientEmail");
var phoneNumber=$("#clientPhoneNumber");
updateClient.postClient().then(function(data) {
});
}
and in the service:
testProjectApp.factory('updateClient', function($http, $q) {
return { ...
Upvotes: 1
Views: 43
Reputation: 38468
You need to define the function in the object you are returning:
testProjectApp.factory('updateClient', function($http, $q) {
return {
postClient : function(firstName, lastName) {
//do stuff
}
}
});
Upvotes: 1