burtelli
burtelli

Reputation: 153

Exclude input events in famous-angular from general Event

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!

Upvotes: 1

Views: 110

Answers (1)

steveblue
steveblue

Reputation: 490

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() }

Upvotes: 0

Related Questions