The problem here is that we introduce hard coupling between `QueryFiddleCtrl` and `EditVisualization` directive. Also there is some code duplications (line 154).

How about saving the query before opening the new visualization tab: when the "+ New" tab clicked, we make sure the query is saved (has an ID). Because of how we rewrite the URL, after the query saved it will get opened on the "+ New" tab.

This can be done with one of 3 ways:
1. Add a `$scope.$watch` on `selectedTab` in `QueryFiddleCtrl` and when it's the new tab, make sure it's saved.
2. Add an event broadcast (`$on`, `$emit`) in rdTabs and handle this event in `QueryFiddleCtrl`.

Honestly I'm not sure which one is better and both feel a bit wrong, but I don't have better ideas. :-) Options 1 feels more Angular (act based on changes in data model).