if you use the @ binding, you may have to use $ watch as follows:
$scope.$watch(function(){ return attrs.hasFocus; }, function(val) { $scope.hasFocus = val; });
if this does not work, or if you prefer two-way binding with = :
<menu has-focus="true" ></menu>
and
.directive('menu', function() { restrict : 'E', templateUrl : 'partials/menu-left.html', replace : true, scope : { hasFocus : '=' }, link : function( $scope, element, attrs ) {
I think two-way binding is better, especially with Boolean ones, because if you only need to control how the DOM looks, you wonβt even have to follow the changes, you just need to connect $ scope.hasFocus to the DOM somewhere (ng- show, ng-switch, etc.)
EDIT: yes, I just noticed your pattern, so if you use two-way snapping ( = ) you don't need a clock
source share