focus

caph.focus.focusController. focus

Changes the current focus item. If the given item is the current focus item, or the given item's depth is not equal to current depth, the focus will not be changed. If there already exists the focused item, blurs it before changing the focus.

(static) focus(item, originalEventopt) → {caph.focus.focusController}

Parameters:
Name Type Attributes Description
item DOMElement | string

A DOM element to be focused. If the string value is passed, it represents the name of the focusable.

originalEvent Event <optional>

The original event. If you want to know about the original event in the handler function, pass it to second parameter.

Returns:
Type
caph.focus.focusController
Example
angular.module('myApp', ['caph.focus']).controller('myController', ['$scope', 'focusController', function($scope, focusController) {
 	$scope.changeFocus = function(name) {
 		focusController.focus(name);
 	}
 }]);