• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in Angular by
Q:
What is a singleton pattern and where we can find it in Angular?

1 Answer

0 votes
by

Singleton pattern in Angular is a great pattern which restricts a class from being used more than once. Singleton pattern in Angular is majorly implemented on dependency injection and in the services. Thus, if you use ‘new Object()’ without making it a singleton, then two different memory locations will be allocated for the same object. Whereas, if the object is declared as a singleton, in case it already exists in the memory then simply it will be reused.

Related questions

0 votes
asked Feb 5 in Angular by SakshiSharma
0 votes
asked Jan 6, 2020 in Angular by sharadyadav1986
...