Fixed js errors in angularjs controller for search.