(function () { 'use strict'; var app = angular.module('ourApp'); app.directive('smFocus', [ '$timeout', function ($timeout) { return { restrict: 'A', scope: { noFocus: "=?" }, link: function (scope, element) { var noFocus; if (angular.isDefined(scope.noFocus)) { console.log("noFocus attribute defined"); noFocus = scope.noFocus; } else { console.log("noFocus attribute is not defined") noFocus = false; } console.log('Element Id= ' + element[0].attributes["id"].value + ' noFocus=' + noFocus); if (!noFocus) { scope.$on('sm:focus', function () { $timeout(function () { element[0].focus(); }, 10); }); } } }; }]); })();I have sm-focus directive on 2 controls. I want to be able to conditionally show focus.