[Answer]-Angular filter weird error even after the functionality works

1👍

Most probably you are loading value of mpttdetails. So at first call of filter it is undefined.

Add check for undefined in your filter implementation.

0👍

as @bekite mentioned, rather than checking if $scope.mpttdetails is undefined simply put $scope.mpttdetails = [] inside your controller, this way forEach will see an empty list rather than an undefined variable.

Leave a comment