Angular Interview : is Angular Service Singleton ? – Dhananjay Kumar
source link: https://debugmode.net/2021/04/14/angular-interview-is-angular-service-singleton/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Angular Interview : is Angular Service Singleton ?
One of the most popular Angular interview questions is, whether a service is singleton?
By default, when you create a service using the below CLI command,
ng g s app
AppService is singleton, however it can be re-provided to create more objects of it. Say, you again re provide AppService in one of the components, then Angular creates one more object of the AppService.
To learn more watch the video.
Rate this:
Related
Learn AngularJS Hour 4: service in AngularJS and making HTTP call using $http
In hour 1 of this series we learnt to get started with AngularJS. In hour 2 of this series we learnt about AngularJS Template. In hour 3 of this series we learnt about two way bindings and filter. In this hour we will learn about, · Using Services in Angular…
August 12, 2014In "Angular"
Services in AngularJS simplified with examples
Read: 21 points cheat sheet on AngularJS controller and the $scope object What is service? It provides us method to keep data across the lifetime of the angular app It provides us method to communicate data across the controllers in a consistent way This is a singleton object and it…
February 19, 2015In "Angular"
Delivering two talks at Devfest Gandhinagar 2019
Ahmadabad is always very close to me as I did my first public speaking in this city back on 24 July 2010. Since then I have been trying to do at least one workshop or talk each year here, so continuing the ritual, I am again coming to Ahmadabad/Gandhinagar on…
October 10, 2019In "Community"
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK