Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is $get in AngularJS?

Tags:

angularjs

I haven't been able to find documentation in AngularJS docs on use-cases of $get. I'm trying to understand where and how to use it.

Below is an example from the AngularJS docs

function GoodProvider() {
  this.$get = angular.noop;
}

Does this attach angular.noop to the GoodProvider function?

like image 553
tim_xyz Avatar asked Oct 21 '25 03:10

tim_xyz


1 Answers

Yes, it attaches noop.

Look at the documentation on Providers, https://docs.angularjs.org/guide/providers

"The Provider recipe is syntactically defined as a custom type that implements a $get method. This method is a factory function just like the one we use in the Factory recipe. In fact, if you define a Factory recipe, an empty Provider type with the $get method set to your factory function is automatically created under the hood."

like image 181
user3288414 Avatar answered Oct 24 '25 07:10

user3288414



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!