[SOLVED] Focus on input hidden input that appears every time button presed

I have an input that appears in the footer whenever y press the add button, and i want to focus the input when it appears, every time it does, i have managed to focus it if it loads with the page , but i need to be shown and focus just when i press the button

Here is the example:

http://play.ionic.io/app/fda3fedb6613

I have modified previous example and get it working!
Later i will try it in my project and post here the results

It worked using this code:

.factory('focus', function($timeout, $window) {
    return function(id) {
      // timeout makes sure that it is invoked after any other event has been triggered.
      // e.g. click events that need to run before the focus or
      // inputs elements that are in a disabled state but are enabled when those events
      // are triggered.
      $timeout(function() {
        var element = $window.document.getElementById(id);
        if(element)
          element.focus();
      });
    };
  }).directive('eventFocus', function(focus) {
    return function(scope, elem, attr) {
      elem.on(attr.eventFocus, function() {
        focus(attr.eventFocusId);
      });

      // Removes bound events in the element itself
      // when the scope is destroyed
      scope.$on('$destroy', function() {
        elem.off(attr.eventFocus);
      });
    };
  })

Then inject focus on the controller

.controller('TestController', function($scope,$ionicScrollDelegate,focus) 

and call

 focus('email');

that focus this input

 <input id="email" type="text" placeholder="text" ng-model="email">