RyanMullins / angular-hammer

Hammer.js v2 support for AngularJS
http://ryanmullins.github.io/angular-hammer/
MIT License
188 stars 55 forks source link

Dynamic hm-recognizer-options #61

Open davizuku opened 9 years ago

davizuku commented 9 years ago

Hello,

I have managed to insert variables from my $scope into the attributes of the hm-recognizer-options directive.

hm-recognizer-options='[
    {"type":"tap","enable":{{!cac.isReduced}}},
    {"type":"press","time":2000,"enable":{{!cac.isReduced}}},
    {"type":"pan","enable":{{!cac.isReduced}}},
    {"type":"pinch","enable":{{!cac.isReduced}}}
]'

However, the options seem to be compiled with the initial value of the variables, and then not updated when the variable cac.isReduced changes its value. I have tried to initialize the app with the variable assigned to true and assigned to false and then change it through the corresponding interaction in the app, resulting in the same events being recognized.

I would say there are some $watch(...) functions missing, but I do not have time to check it.

Can you have a look at this problem?, I think it would improve a lot the library :).

Thank you in advance!