angular refactoring on search results