Nazir Doğan Code Blog

Focusing an Input Field Ionic and Angular Application.

| Comments

if you developing Angular/Ionic application. Maybe you need to focusing input field. with this small code snippet is very easy.

factory('focus', function($timeout, $window) {
        return function(id) {
            $timeout(function() {
                var element = $window.document.getElementById(id);
                if(element)
                    element.focus();
            });
        };
    });

 

Full example on Codepen

 

Comments