The cost of a simple watch expression like this is minimal. The only 
problem I see with your directive is that you should not be using isolate 
scope. As a general rule, you should almost never use isolate scope unless 
you are using a template (this is mostly so that your template is isolated 
from the names of parameters (because your isolate scope can take 
expressions and expose them under a new name in a private scope.

Your directive doesn’t really use scope other than to pull data from the 
non-isolate scope (by having to do [image: scope.]parent). It is very rare 
for [image: scope.]parent to be needed and it is typically a sign that you 
are doing something wrong. 

In your case I would just simply do scope: false in your directive or 
simply not include scope attribute at all. Then you just set up a simple 
watch on the $scope (you don’t need to do $parent). 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to