Science, asked by Ghaintjatti2131, 1 year ago

What is a singleton pattern and where we can find it in Angularjs?

Answers

Answered by Kanagasabapathy
0
Is a great pattern that restricts the use of a class more than once. We can find singleton pattern in angular in dependency injection and in the services.

In a sense, if you do 2 times ‘new Object()‘ without this pattern, you will be alocating 2 pieces of memory for the same object. With singleton pattern, if the object exists, you reuse it.
Similar questions