$scope is a variable provided internally by angular.
scopeGenerally refers to concepts such as scope directive service and so on.
In terms of variables
function($scope){
}
function(scope){
}
No difference.
But the scope or $scope object above is an object provided internally by angular. We usually obtain this object through dependency injection. If you display dependencies:
Following the answer above, the implicitly injected code
app.controller("MainCtrl",function($scope){
});
$scope can be injected through implicit injection, but when compressing js code, variable names are usually replaced with abbreviations such as abc, causing implicit injection to fail. Therefore, display injection is generally used. At this point, whether to use $scope or scope becomes part of the coding specification, and there is no difference.
$scope
is a variable provided internally by angular.scope
Generally refers to concepts such as scope directive service and so on.In terms of variables
No difference.
But the scope or $scope object above is an object provided internally by angular. We usually obtain this object through dependency injection. If you display dependencies:
The injected variable name must be $scope, and the formal parameters in the function do not matter.
If it is implicit injection,
The function parameter must be $scope
Following the answer above, the implicitly injected code
$scope can be injected through implicit injection, but when compressing js code, variable names are usually replaced with abbreviations such as abc, causing implicit injection to fail. Therefore, display injection is generally used. At this point, whether to use $scope or scope becomes part of the coding specification, and there is no difference.