+++
date = "2018-09-22T09:31:00-01:00"
draft = false
title = "Enable auto fit bounds"

+++

Angular Google Maps (AGM) has an auto fit bounds feature, that adds all containing components to the bounds of the map. 
To enable it, set the `fitBounds` input of `agm2-map` to `true` and add the `agmFitBounds` input/directive to `true` for all components
you want to include in the bounds of the map.

```html
<agm2-map [fitBounds]="true">
  <agm2-marker [agmFitBounds]="true"></agm2-marker>

  <!-- not included -->
  <agm2-marker [agmFitBounds]="false"></agm2-marker>
</agm2-map>
```