I have a list of items from $scope, and I bind jQuery event with them, and I use a input field to filter the list. Everything works as expected.
When I type something in the input field, the items filtered out will still be bound with the jQuery event; however, if I delete the text from the input field, the re-appearing items seem to be out of the scope.
You can check this plunker. When I click on the button in the list, an alert will pop up, but if I type b in the input box, and then delete it, clicking the button with text a will not show you the pop up.
How can I fix this?
Thanks in advance.
Update:
Thanks for the answers, I'm sorry to mislead you by using such a simple example :/ the actual situation is quite different. Anyway, using jQuery .on is not a good idea here, what I should do is to pass the $event object to a function within the scope, and handle the DOM element inside that function.