ng-click not working on bound anchor controls

2,931 views
Skip to first unread message

suresh

unread,
Jul 21, 2012, 1:53:05 PM7/21/12
to ang...@googlegroups.com
ng-click doesn't seem to work on bound anchor controls.

Am I missing something?

The links below in Red don't work.  The link in Green works.

<div class="pagination">
                        <ul>
                            <!-- ngRepeat: page in pages -->
<li ng-repeat="page in pages" class="ng-scope"><a ng-click="goToPage(0, searchCriteria);" href class="ng-binding">1</a></li>
 
<li ng-repeat="page in pages" class="ng-scope"><a ng-click="goToPage(1, searchCriteria);" href class="ng-binding">2</a></li>
 
<li ng-repeat="page in pages" class="ng-scope"><a ng-click="goToPage(2, searchCriteria);" href" class="ng-binding">3</a></li>
 
<li ng-repeat="page in pages" class="ng-scope"><a ng-click="goToPage(1, searchCriteria);" href class="ng-binding">Next</a></li>
                        </ul>
                        
                        <a ng-click="goToPage(1, searchCriteria);" href="">Page</a>
                    </div>

Thanks,
Suresh.

Peter Bacon Darwin

unread,
Jul 21, 2012, 2:13:23 PM7/21/12
to ang...@googlegroups.com
I think you need to provide a jsfiddle or plunker demonstrating this as there are many reasons why this might not work.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/kzKV_3aVBn8J.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

suresh...@gmail.com

unread,
Jul 21, 2012, 7:00:26 PM7/21/12
to ang...@googlegroups.com
http://jsfiddle.net/sm20030/76HvF/6/

Thanks,
Suresh.
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.

suresh...@gmail.com

unread,
Jul 25, 2012, 8:54:05 PM7/25/12
to ang...@googlegroups.com, suresh...@gmail.com, andyt...@gmail.com
Thank you Andy.  It worked!!

Update Fiddle in case some one else runs into a similar issue.


~Suresh.

On Saturday, 21 July 2012 22:24:21 UTC-7, Andy Joslin wrote:
Hi suresh,

Try ng-click="goToPage(page.Index)"

Also, ng-repeat provides you with an $index variable, marking the current index (http://docs.angularjs.org/api/ng.directive:ngRepeat), so you can do even better.

ng-click="goToPage($index)"

chri...@gmail.com

unread,
Sep 25, 2012, 3:14:46 PM9/25/12
to ang...@googlegroups.com, suresh...@gmail.com
How did you get this to work? Both fiddler links are broken so I can't see what the fix was.

Alvin Crespo

unread,
May 3, 2013, 12:01:40 PM5/3/13
to ang...@googlegroups.com, suresh...@gmail.com, chri...@gmail.com
Yup same here. I'm having the same issue but the fiddler links are not working :(
Reply all
Reply to author
Forward
Message has been deleted
0 new messages