This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$compile: "the root of the template always gets a new scope..." What is it about? #15109
Closed
Description
In the docs for $compile, we can read the following:
The scope property can be true, an object or a falsy value: ...
true: A new child scope that prototypically inherits from its parent will be created for the directive's element. If multiple directives on the same element request a new scope, only one new scope is created. The new scope rule does not apply for the root of the template since the root of the template always gets a new scope.
I can't understand the last sentence. Does it mean that even if you set scope
to false
in the DDO, your directive will create a new scope if it has a template? Then, it's not true: see this plunk. Does this sentence mean something different?