top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

+2 votes
381 views
What is a singleton pattern and where we can find it in Angularjs?
posted Aug 11, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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 allocating 2 pieces of memory for the same object. With singleton pattern, if the object exists, you reuse it.

answer Aug 22, 2017 by Sathish Kumar
...