Different between $scope and scope?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajesh GamiRank #30 · 41.5K reputationPosted Nov 15, 2022, 8:52 AM EST
The case when you do
$scopein controller the Dependency Injection injects scope based on matching the variable name$scope, in this case usingscopeas name would not work.For case of directive the injection is position based so you can name your variable
aorbor any thing. The directive order for link function is(scope, iElement, iAttrs, controller)so first element is always scope object.
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Nov 13, 2022, 4:10 AM EST
https://www.c-sharpcorner.com/article/difference-between-scope-and-rootscope-in-angularjs/
Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Nov 13, 2022, 9:37 AM EST
The $ in "$scope" indicates that the scope value is being injected into the current context. $scope is a service provided by $scopeProvider . You can inject it into controllers, directives or other services using Angular's built-in dependency injector: module.