In angular directives I've seen in tutorials either
link: function($scope,$element,attrs)
or
link: function(scope,element,attrs)
Now I know that the '$' means a service in angular , does this hold here ? What exactly is the difference between $scope and scope ? Same goes to element vs $element
In your specific example, it does not matter what the parameters are named in your link function. When Angular processes the directive, it will pass the scope, element and attrs (and even a controller instance if configured) to your link function.
You could do this (not recommended):
link: function (s, e, a)
and it will work fine.
$ is the prefix used by Angular. It is a convention and helps avoid naming collisions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With