angular / angular/components

bug(google-maps): Zoom not updated on centerChange

Open
#24,495 2 comments 3 reactions 0 assignees View on GitHub
area: google-maps P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### What are you trying to do?

Trying to zoom map after center change:
google-maps.component.html
```

```

google-maps.component.ts
```
export class GoogleMapsComponent {
@Input() center!: google.maps.LatLngLiteral;
zoom = 17;
...

centerChanged() {
console.log('center changed');
this.zoom = 17;
}
```

### What troubleshooting steps have you tried?

Zoom is not changed

### Reproduction

Steps to reproduce:
1. User changes zoom
2. User clicks on marker link that updates center variable.
3. Center is changed, console.log is fired but zoom is not updated

### Environment

- Angular: 12.2.6
- Browser(s): Firefox/Chrome
- Operating System Windows

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three steps in google-maps.component.html with the corresponding logic in google-maps.component.ts, confirming that centerChanged fires while zoom remains unchanged. Trace the Angular Google Maps binding behavior and verify the fix by ensuring a center update restores the zoom to 17.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.