Aladdin Mhemed
Aladdin Mhemed

Reputation: 3971

What is the meaning of scope:true in angularjs directive

I understand that if scope:false, this means that the directive will have no scope of its own.

If scope:{something} this means there will be an isolated scope for the directive.

What about scope:true ?

what does it mean? and what is it good for?

thank you

Upvotes: 3

Views: 839

Answers (1)

Wottensprels
Wottensprels

Reputation: 3327

This tells Angular to create a new scope for that directive. If omitted, the directive would rely on the current scope (the controller's in most cases)

From docs:

SCOPE If set to true, then a new scope will be created for this directive. 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.

See: $compile for further information.

Upvotes: 4

Related Questions