factory() service()
The factory function allows developers to add certain logic before the creation of an object. This one is a constructor function which helps creating the object with a new keyword. Developers can add functions and properties to a service object by using the keyword.
It will return the created object. It returns nothing.
Syntax:
app.factory('serviceName',function(){ return serviceObj;}
Syntax:
app.service('serviceName',function(){})
BY Best Interview Question ON 16 Feb 2020