0

I'm experiencing trouble with an angular-ui plugin (ui-select): for some reason, I cannot select any option.

Looking in dev tools and changing the ng-click attribute for the relevant DOM element to alert('test'); doesn't result in the alert being called either. This leads me to believe ng-click isn't being called for some reason.

Anyway, since I cannot find any information on this and I'm suspecting there might be a compatibility issue with another plugin or library. I'm wondering if there is any way that I can debug ng-click operations. I'd like to be able to pinpoint where in the event chain things go wrong.

David Tansey
  • 5,813
  • 4
  • 35
  • 51
klmdb
  • 765
  • 1
  • 10
  • 21
  • [Batarang](https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en) might be what you need. – Blazemonger Dec 15 '14 at 17:00
  • @Blazemonger I'm already using Batarang. I'm no expert with it, but I did check if the element that should call $select.select() has access to the right scope. Batarang says it does. I'm not sure how it could help me in a different way. – klmdb Dec 15 '14 at 17:15

2 Answers2

1

There is a very useful post related to this post regarding why angular fails silently on errors in expressions

The work flow I have found to work for me is to first double check that your controller method or function that you are calling exists in your current scope. This can be a pain to debug, but often times I have found it's just a typo on my part.

I would start by putting debugger in the first line of that function or method and determining if your program haults there.

PS: another explanation for this behavior

Community
  • 1
  • 1
zedd45
  • 2,101
  • 1
  • 31
  • 34
-3
  • Load Chrome to your web site.
  • Press F12 for dev mode.
  • Go to Sources.
  • Set breakpoints in your JS files.
vidalsasoon
  • 4,365
  • 1
  • 32
  • 40
  • 1
    Where should I put breapoints? when I put one in the ui-select library (yes, I put it at the beginning of $select.select() (the method ng-click should call) ), but it doesn't break. That's why I'm looking for a way to debug the ng-click event chain in angular itself. – klmdb Dec 15 '14 at 17:09
  • the vanilla "ng-change="doSomething()" for selects doesn't work with ui-select? – vidalsasoon Dec 15 '14 at 17:14
  • It should, but since I cannot select any options, the model isn't updated nor ng-change called. – klmdb Dec 15 '14 at 17:18