Related Resources

Our Services

You May Also Like

Difference between Service and Factory in Angular

Krunal Shah

Sep 02, 2017

1 min readLast Updated Dec 01, 2022

Difference between Service and Factory in Angular

This is the most common question that asked by most of the interviewers.

What is Service? Let me explain with a small example.

Service is a constructor function and that will be called with “new” keyword

myApp.service(‘serviceDemo’, function() {
  this.demo = function() {
    return ‘hello’;

What is Factory? Let me explain with a small example.

Factory returns an object when it is created , you can also add some logic before return object.

myApp.factory(‘factoryDemo’, function() {
  return {
    demo : function() {
      return ‘demo’;

When some ask’s you the same thing share Third Rock Techkno’s blog to them.

Happy coding!

Do share your feedback. And don’t forget to checkout Third Rock Techkno‘s extension Quick Capture :)

· · · ·

Third Rock Techkno is a leading IT services company. We are a top-ranked web, voice and mobile app development company with over 10 years of experience. Client success forms the core of our value system.

We have expertise in the latest technologies including angular, react native, iOs, Android and more. Third Rock Techkno has developed smart, scalable and innovative solutions for clients across a host of industries.

Our team of dedicated developers combine their knowledge and skills to develop and deliver web and mobile apps that boost business and increase output for our clients.

Projects Completed till now.

Discover how we can help your business grow.

"Third Rock Techkno's work integrates complex frameworks and features to offer everything researchers need. They are open-minded and worked smoothly with the academic subject matter."

- Dr Daniel T. Michaels, NINS