Skip to content

Commit d21644f

Browse files
authored
Added Angular support to docs
1 parent 8abb9b7 commit d21644f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,30 @@ exports.onMapReady = onMapReady;
120120
exports.onMarkerSelect = onMarkerSelect;
121121
exports.onCameraChanged = onCameraChanged;
122122
```
123+
124+
## Angular
125+
126+
```
127+
import {Component, ElementRef, ViewChild} from '@angular/core';
128+
import {registerElement} from "nativescript-angular/element-registry";
129+
130+
registerElement("MapView", () => require("nativescript-google-maps-sdk").MapView);
131+
132+
@Component({
133+
selector: 'google-maps-example',
134+
template: `
135+
<GridLayout>
136+
<MapView (mapReady)="onMapReady($event)"></MapView>
137+
</GridLayout>
138+
`
139+
})
140+
export class GoogleMapsExample {
141+
142+
@ViewChild("MapView") mapView: ElementRef;
143+
144+
//Map events
145+
onMapReady = (event) => {
146+
console.log("Map Ready");
147+
};
148+
}
149+
```

0 commit comments

Comments
 (0)