MChan
MChan

Reputation: 7212

AngularJS multiple functions in service

I have the following service in my AngularJS app, but I am getting error

Uncaught SyntaxError: Unexpected identifier
Error: [$injector:unpr] Unknown provider: NewContactDataProvider <- NewContactData

my NewContactData code:

myApp.factory('NewContactData', function($http,$log, $q) {
 return {    
   saveContact: function(contact){
   } 
   getContacts: function(){

   }      
 }; 
});        

Can someone please point to me what I am doing wrong in it? I just defined a new function getContacts that's all.

Thanks

Upvotes: 1

Views: 875

Answers (1)

Pascal Precht
Pascal Precht

Reputation: 8893

There's a missing comma in your code :) try:

myApp.factory('NewContactData', function($http,$log, $q) {
 return {    
   saveContact: function(contact){
   }, 
   getContacts: function(){

   }      
 }; 
}); 

Upvotes: 1

Related Questions