- Install the package in your angular 17
npm install ngx-leaflet-neshan-map
- Add css and js file to assets in angular.json (leaflet.js version 1.9.4)
node_modules/ngx-leaflet-neshan-map/assets/leaflet/leaflet.css,
node_modules/ngx-leaflet-neshan-map/assets/leaflet/leaflet.js
- Import the NgxLeafletNeshanMapModule to your AppModule file and register it in the imports:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgxLeafletNeshanMapModule } from 'ngx-leaflet-neshan-map';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NgxLeafletNeshanMapModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
- Implement config model of library in your AppComponent
import { NeshanMapConfigModel } from 'ngx-leaflet-neshan-map/models/neshan-map-config.model';
config : NeshanMapConfigModel = {};
- Add ngx-leaflet-neshan-map element to your template and bind your model to input name 'neshanMapConfig'
<ngx-leaflet-neshan-map [neshanMapConfig]="config"></ngx-leaflet-neshan-map>
- You can get map Object after create by emitter event:
<ngx-leaflet-neshan-map (mapObjectEmitter)="" [neshanMapConfig]="config"></ngx-leaflet-neshan-map>
For supporting development! Install npm i