Centralize legend getter in a service

This is an attempt to avoid code duplication.

The function getLegend was used in both the catalog directive and the search directive.

The getLegend function would now be centralized in gaLegend.

This PR also includes:
1) As SuggestionRendered event is fired multiple times for each query, the html elements were compiled several times as well. As a result, ng-click was fired twice. Now, we make sure we compile only when all the suggestions are ready for a given query.

2) In PopupService a child scope is created if no scope is in the method "open"

3) CatalogitemDirective has been adapted to the new LegendService