Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I would like to know what it mean when directive definition have no scope:, and also what would be equivalent if I where to add scope:.

Like this example:

.directive('myCustomer', function() {
  return {
    template: 'Name: {{customer.name}} Address: {{customer.address}}'
  };
});
share|improve this question

closed as too broad by Claies, Logan Wayne, Igor, reto, Yvette Oct 21 at 9:24

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
docs.angularjs.org/guide/directive. Clearly laid out in the documentation, and much too much information to cut and paste into an answer here. – Claies Oct 21 at 7:55

1 Answer 1

up vote 2 down vote accepted

Short answer: It means that it that the directive inherits the scope of the controller and doesn't have its own 'isolate scope'.

Not having an isolate scope means more coupling with the controller and less reusability (as it depends on the controller's scope).

share|improve this answer
    
What would be equivalent "scope:"? "scope: true" ? – przemo_li Oct 21 at 13:09
    
yes, if you want an isolated scope in the directive. – Tarun Dugar Oct 21 at 13:20
    
did the answer help you? – Tarun Dugar Oct 21 at 14:08
    
No. I do not want to change any behaviour. I ask what is equivalent "scope:" notation to having no "scope:". Is there equivalent? – przemo_li Oct 21 at 14:15
    
To not have an isolate scope, dont have a scope property in your directive. – Tarun Dugar Oct 21 at 15:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.