ng4-baidu-map
v2.6.2
Published
ng4 component for Baidu map
Downloads
9
Readme
ng4-baidu-map
[![NPM version][npm-image]][npm-url] ![][david-url] ![][dt-url] ![][license-url]
Baidu-Map module for Angular4
Read full documentation here: documentation
Read code example here: example
Be aware that it is a totally rewrite version, therefore, backward compatibility is not considered
Getting started
npm install ng4-baidu-map
Usage
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { BaiduMapModule } from 'ng4-baidu-map';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BaiduMapModule.forRoot({ak: 'your ak'})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
app.component.ts
import { Component } from '@angular/core';
import { MapOptions } from 'ng4-baidu-map';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: []
})
export class AppComponent {
options: MapOptions;
constructor() {
this.options = {
centerAndZoom: {
lat: 39.920116,
lng: 116.403703,
zoom: 16
},
enableKeyboard: true
};
}
}
app.component.html
<baidu-map [options]="options" style="display: block; width: 550px; height: 350px;"></baidu-map>