Angular Link Function: $scope Vs Scope
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 an
Solution 1:
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.
Post a Comment for "Angular Link Function: $scope Vs Scope"