1

I'm writing a mobile app with famous/angular. A swipe to the right in any view reveals the menu. For this I have set up the following event handling:

var MouseSync   = $famous["famous/inputs/MouseSync"];
var TouchSync   = $famous["famous/inputs/TouchSync"];
var GenericSync = $famous['famous/inputs/GenericSync'];

$scope.sync = new GenericSync(
        ["mouse", "touch"], 
        {direction: GenericSync.DIRECTION_X}
);

$scope.sync.on('update', function(data){
    // do stuff while swiping
});

$scope.sync.on('end', function(data) {
    // do stuff at swipe end
});

The above is all working fine. My problem now is that I have html inputs in some of the views which I cannot access/enter due to the above. The surfaces in which these are contained pipe their events to 'sync':

<fa-surface fa-pipe-to="sync">
    <input type="text"></input>
</fa-surface>

I know that the issue here is that the click-event on my input is passed on to sync. I just don't know what to do about it. Any ideas?

Many thanks!

burtelli
  • 153
  • 9

1 Answers1

0

Did you try the HTML5 autofocus attribute <input type="text" autofocus></input> or setting the focus on click? <input type="text" ng-click="focus($event)"></input>

For the second option, you will need to set up a function on the scope as follows:

$scope.focus = function(ev){ ev.target.focus() }

steveblue
  • 455
  • 4
  • 19
  • Thanks, man. Your second idea works. However, as the event still gets passed to sync swiping remains enabled on the input which isn't good when selecting the entered text for example. So this doesn't fully solve the problem yet. Do you think switching from pipe-to to subscribe-from might help? I'll give that a go later today... cheers! – burtelli Feb 12 '15 at 09:19
  • Thats tough... Can you setup a JSFiddle or Codepen and I can take a look? – steveblue Feb 12 '15 at 20:01
  • oddly it works without a problem on mobile devices. for some reason the touch event is handled differently than click. nevertheless, i'll look into subscribe-from hopefully today and if that doesn't do it i'll set up that jsfiddle. thanks. – burtelli Feb 13 '15 at 08:19