The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

$scope vs. scope

$scope vs. scope

9:14
This episode is explaining the naming conventions behind for the arguments passed to the factory functions for controllers, directives, linking functions, etc., its implications in regard to Angular’s dependency injection, minification side effects on arguments, and how to prevent them.
Watch this lesson now
Avatar
egghead.io

This episode is explaining the naming conventions behind for the arguments passed to the factory functions for controllers, directives, linking functions, etc., its implications in regard to Angular’s dependency injection, minification side effects on arguments, and how to prevent them.

Avatar
Simon

If I want to have $scope injected in my directive and also have the scope through the call of the link-function will it always be the same?

In reply to egghead.io
Avatar
John

You mean injecting the $rootScope into your directive?

The directive will share the scope of its parent unless you isolate it in your directive object.

In reply to Simon
Avatar
Nolan

Correct me if I'm wrong, but another point is that the $scope within a Ctrl will always be the $scope of that controller whereas the scope of a directive can inherit the scope of any controller it is placed within - assuming the 2nd controller is a peer and not a child of the first.

In reply to John
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?