Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('popupApp').directive('autoFocus', function($timeout, $parse) {
- return {
- restrict: 'AC',
- scope: { trigger: '=autoFocus' },
- link: function(scope, element, attrs) {
- scope.$watch('trigger', function(value) {
- if(value === true) {
- $timeout(function() { element[0].focus(); }, 500);
- scope.trigger = false;
- }
- });
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement