如何在 Google 自动完成(ngx-autocom-place)中仅在特定半径内 return 自动完成值?

How to return autocomplete values only in a specific radius in Google Autocomplete (ngx-autocom-place)?

我正在尝试使用我的 Angular 应用程序中的 Google 地点,以 return 自动完成输入地址结果中的用户,该结果位于某个位置的半径范围内,所以从 documenentation 我应该使用参数 location radiusstrictbounds.

要使用自动完成,我正在使用以下 ngx library 但问题是,在设置选项中的所有参数后,当我首先尝试写入某个地址时,我只得到那个是在范围内,但如果我无论如何尝试写一个超出范围的城市,甚至是另一个超出范围的城市,它仍然会 return 该值,我会阻止它。

这是我的自动完成选项

  addressOptions = {
    types: ['address'],
    componentRestrictions: {
      country: 'it'
    },
    location: new google.maps.LatLng( 44.7179422, 10.5465457),
    radius: '1000',
    strictbounds: true
  };

        <input
          type="text"
          class="form-control"
          required
          placeholder="es. Via D'israeli"
          formControlName="indirizzo"
          ngxAutocomPlace
          [options]="addressOptions"
          (selectedPlace)="addressChange($event)"
        />

mytyuk,好像只有通过bounds时才考虑strictBounds 属性 (https://developers.google.com/maps/documentation/javascript/places-autocomplete)

strictBounds is a boolean specifying whether the API must return only those places that are strictly within the region defined by the given bounds. The API does not return results outside this region even if they match the user input.