English, asked by bangaraniket5573, 1 year ago

What is difference between factory and service in angularjs?

Answers

Answered by pulkitdube
1
Factory can return anything which can be a class(constructor function) , instance of class , string , number or boolean . If you return a constructor function, you can instantiate in your controller. Service does not need to return anything. ... Because service will create instance by default and use that as a base object.

pulkitdube: Hope it will help you. Please mark the answer as the Brainliest.
Answered by no4
0
Heyaa folk,

Mark my this answer as BRAINLIEST plz..okk ??

So then we look at answer =>>>

# FACTORY :-

☆ Factory is most preferable in all cases.
☆ It can be used when, you have constructor function.
☆ Which needs to be instantiated in different controllers.


# SERVICES :-

☆ Service is a kind of singleton object.

☆ The Object return from service will be same for all controllers.


Hope it helps u :)
MARK ME AS BRAINLIEST PLZ PLZ PLZ. . .
Similar questions