-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Programmatically triggering a 'click' events does not work inside ng-repeate, when using external jQuery library #3470
Comments
This issue might be related to #1574. |
While it's definitely weird, I don't think it's something that should necessarily be possible, as angular always drives the view from the model (or from real input). For testing, there's always browserTrigger |
The smlz jsfiddle is using 1.1.1 Problem still exists with 1.2.19. |
@kbdaitch I'm pretty sure this is your problem. (so basically, add an href) |
the empty string is falsy --- you'd need something like |
I tried with the Wonder if there are directive priorities at play? My <div id="keypad" class="large-5 columns large-centered">
<ul class="large-block-grid-3">
<li><a ng-click="appendValue('1')" ng-disabled="disabled" class="button expand" href="#">1</a></li>
<li><a ng-click="appendValue('2')" ng-disabled="disabled" class="button expand" href="#">2</a></li>
<li><a ng-click="appendValue('3')" ng-disabled="disabled" class="button expand" href="#">3</a></li>
... omitted ...
<li><a ng-click="backspace()" ng-disabled="disabled" class="button secondary expand" id="delete" href="#"><i class="fa fa-long-arrow-left"></i></a></li>
<li><a ng-click="appendValue('0')" ng-disabled="disabled" class="button expand" href="#">0</a></li>
</ul>
</div> Also, I don't want the links to take the user to the application homepage: should I be using a |
maybe I'm not understanding what you're actually trying to do. It sounded like you were saying you need to follow links, but your ng-clicks wouldn't work (this would happen if you were missing an href, because of the preventDefault() in the anchor directive). What exactly do you mean by "programmatically getting it" |
I believe @kbdaitch is using It is not clear how that programmatic clicking is implemented, so a reproduction would be useful (e.g. in a plunkr or fiddle), or at least the "clicking" part of the code. |
@kbdaitch: It basically seems to work for me (without adding any |
@gkalpak Thanks. Your fiddle helped me quickly test whether the click would work with a directive in the mix as well. It does work well. My problem was arising due to It return the |
That's great ! BTW, it is usually preferable to place your |
Regarding the original issue: |
I have noticed this problem in 1.2.28 (not ready to upgrade to 1.3) when running specs under Chrome 40 (have not tried elsewhere yet). Resolving by simply clicking twice:
This seems to be a problem unique to radio, as a similar checkbox control works fine with one click(). |
We are seeing this issue with checkboxes in 1.3.14. We weren't seeing it in 1.2.18. These are checkboxes with an ng-change. |
FYI, I also get this issue. It concerns only radio buttons since I checked that it works well with checkboxes. I'm using angular 1.3.14. I think this was working with angular 1.2.x but not sure. |
The problem is that after |
Similar issue is there with checkbox.
But If I want to click (as it was clicked by user (not speaking of 3times triggering click in code)) the checkbox once, then check something and then click it 2nd time, this serie of 3 click triggerings behaves probably as if The click has been triggered 6 times and that doesn't give desired result. |
I cannot reproduce the original issue in 1.3.0 and above, see http://plnkr.co/edit/1wE6wrCAZ9wwPryIElep?p=preview Any other issues mentioned in this thread must be different from the original issue. If there are still issues, please open a new issue with a repro. |
When
the model does not get updated, even though the effects of selecting the radio button are visible on the screen,.
However,
$('input[name=test]').trigger('click').trigger('click')
)does give the expected results.
For full demo of the problem see the following jsfiddle: http://jsfiddle.net/MpyFW/8/
Being able to programmatically trigger events would be quite usefull for automated testing.
The text was updated successfully, but these errors were encountered: