The best may be to rely on a service (possibly based on gaPopup) rather than a directive for the context popup functionality. It is indeed a bit silly to add nodes to the page that will eventually be removed and added elsewhere (the map overlay container here). For now I think @tonio's code is fine.