Is there an event that is sure to fire when google maps is loaded, when using angular js?
<p>I am using angularjs and ngmap (<a href="https://ngmap.github.io" rel="nofollow">https://ngmap.github.io</a>).
The map is initially hidden from view (using ng-show), and i want to be able to toggle between views without having to reload the whole map.
I also want to display a kml on the map.</p>

<p>The map is only initialized (using lazy initialization) when that part of the page is shown.</p>

<p>It seems to work fine, except that sometimes the map can't zoom into the kml (using fitBounds). I think I have established that this is because the height of the containing div is zero (due to the controller code firing before the view is actually rendered), and fitBounds needs that.</p>

<p>I am trying to wait until I am sure the map is good and ready. I have tried the following events:</p>

<ul>
<li>bounds_changed</li>
<li>tilesloaded</li>
</ul>

<p>but neither do what I want.</p>

<p>Currently I am using a $timeout, but I don't like it, as I don't know how long it takes to initialize the map, and whether or not my code will fire between that time.</p>

<p>My next idea is to repeatedly check for the height of the map, but I would prefer something more explicit.</p>

<p>Another idea is to always have the map in the background, and use absolute positioning to cover it with the other information when that part is visible, but that breaks my current design.</p>