Recently, I created this sample code based on an Angular tutorial I was following. It's pretty simple and helped me learn a lot about the framework.
Check out the jsFiddle link here
I have a couple of questions regarding this code:
How does the
categoryFilterFn
function get executed? I assume that anything bound to the HTML view and the$scope
is automatically triggered when there are some changes.Another thing is, why does the filter run twice? When you observe the example, you will notice that there are eight console statements for just four products. This behavior remains even if I consolidate everything into one controller.