Service Vs Factory

Var service = {prop:val,prop1:val1} return service;

 

Function val(){

Var xyz =1;

}

 

Now if you have val2 like

Function val2(){

Var hidingfunction = ‘tree’;

}

 

You can hide this val2 without calling in service, so that its not displayed to users.

 

One more difference is factory works in pass by reference, means if you add any one function from controller to factory..all controllers calling service will effect with new added function. Where as service cannot.

 

To be contd…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s