Aladdin Mhemed Aladdin Mhemed - 1 year ago 95
AngularJS Question

What is the default for AngularJS directive scope?

What is the default scope value of an AngularJS directive?

Of course, it is not isolated scope. It is true or false.

I can't find any documentation on what it is.

Answer Source

"Note, by default, directives do not create new scope -- i.e., the default is scope: false"

from Understanding scopes.

Using the scope option in directive you can:

  • create a child scope prototypically inherited with scope: true
  • create an isolated scope with scope: {} then you can bind some property to parent scopes with '@', '&', '=' (see this question).
  • decide to not create a new scope and use parent with scope: false (default).
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download