0.1.4 • Published 1 year ago
new-library-component v0.1.4
NgxMapview
Thư viện hỗ trợ hiển thị map với leaflet.
Cài đặt
npm install ngx-mapview --save
Quick Start
1. Cài đặt thư viện
npm install ngx-mapview --save
2. Import thư viện vào module: app.module.ts
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
NgxMapviewModule
],
providers: [],
bootstrap: [AppComponent]
})
3. Sử dụng
app.component.html:
<ngx-mapview [style]="optionStyle" [tileLayers] = "tileLayers"></ngx-mapview>
app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
optionStyle:any = {
with:'100%',
height:'100%'
}
tileLayers:any[] =[
{url:'https://tile.openstreetmap.org/{z}/{x}/{y}.png'}
]
}
Run ng generate component component-name --project ngx-mapview
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-mapview
.
Note: Don't forget to add
--project ngx-mapview
or else it will be added to the default project in yourangular.json
file.