Files
stf-DeviceFarmer/res/app/components/stf/common-ui/blur-element/blur-element-directive.js
Gunther Brunner 4edcb387d4 Added favicon resolving to URL input.
Added blur event after entering URL.
Focus screen after entering URL.
2014-07-31 20:30:43 +09:00

21 lines
469 B
JavaScript

module.exports = function blurElementDirective($parse, $timeout) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var model = $parse(attrs.blurElement)
scope.$watch(model, function (value) {
if (value === true) {
$timeout(function () {
element[0].blur()
})
}
})
element.bind('blur', function () {
scope.$apply(model.assign(scope, false))
})
}
}
}