title: Simple Backbone.js and Google Maps Rendering
body: <p>I'm having trouble rendering Google Maps (V3) with Backbone.js.</p>
  
  <p>It fails to load when I navigate to map view (/#/map); however, the map somehow loads perfectly fine when I hit refresh in that map view url. </p>
  
  <p>Relevant Code Below:</p>
  
  <hr>
  
  <pre><code>&lt;body&gt;
      &lt;a href="#"&gt;Home&lt;/a&gt;
      &lt;div id="content"&gt;&lt;/div&gt;
  
  
      &lt;script type="text/template" id="home_template"&gt;
          &lt;a href="#/map"&gt;Go !&lt;/a&gt;
      &lt;/script&gt;
  
      &lt;script type="text/template" id="map_template"&gt;
          &lt;div id="map"&gt;&lt;/div&gt;
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>var MapView = Backbone.View.extend({
      el: '#content',
  
      render: function() {
          var template = _.template($('#map_template').html());
          var init = function() {
              var mapOptions = {
                  center: new google.maps.LatLng(-34.397, 150.644),
                  zoom: 8,
                  mapTypeId: google.maps.MapTypeId.ROADMAP
              };
              var map = new google.maps.Map(document.getElementById("map"),
              mapOptions);
          }
          google.maps.event.addDomListener(window, 'load', init);
          this.$el.html(template);
      }
  });
  </code></pre>
  
  <hr>
  
  <pre><code>var Router = Backbone.Router.extend({
      routes: {
          ""      :   "home",
          "map"   :   "map" 
      }
  });
  var router = new Router;
  
  var homeView = new HomeView();
  router.on('route:home', function() {
      homeView.render();
  });
  
  var mapView = new MapView();
  router.on('route:map', function() {
      mapView.render();
  });
  
  Backbone.history.start();
  </code></pre>
  
  <hr>
  
  <p>It seems that 'something' is missing when I'm switching views between home and map, but I'm not sure what that 'something' is. I believe I have combed through relevant questions, but cannot find the missing point.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thank you!</p>
  
  <p>(P.S The Mapview part is taken from : <a href="https://developers.google.com/maps/documentation/javascript/tutorial" rel="nofollow">https://developers.google.com/maps/documentation/javascript/tutorial</a>
  )</p>