Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between service class and typescript class in angular 6

I need a clear understanding of service class in angular.Both service class and typescript class are the same use case in my view then what is the difference between two?

like image 285
Vijay VJ Avatar asked Apr 08 '26 01:04

Vijay VJ


1 Answers

In case of implementation all angular service , component , module , pipes .. are just typescript class the only difference between each of them is the decorator,but it 'is possible for any service to don't have a decorator if it's has no dependency

finally to declare any class as service you need add this class to any provider list for module or component so you can injected.

so just look for class decorator and if the class added to any provider list

like image 194
Muhammed Albarmavi Avatar answered Apr 10 '26 00:04

Muhammed Albarmavi