Created
April 19, 2016 22:38
-
-
Save oddlyfunctional/055b1e015c0a94bbf2993de19cce20ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
focusOn = ($timeout) -> | |
link = (scope, element, attrs) -> | |
scope.$watch attrs.focusOn, (newValue) -> | |
$timeout(-> element.focus()) if !!newValue | |
restrict: 'A' | |
link: link | |
focusOn.$inject = ['$timeout'] | |
angular | |
.module('app.lessonPlan') | |
.directive('focusOn', focusOn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment