问题描述
我必须在我正式使用角度的地方创建传单地图。
我已经为传单地图创建了自定义组件
leaflet.component.ts
import { Component,OnInit } from '@angular/core';
declare let L: any
@Component({
selector: 'app-root',templateUrl: './app.component.html',styleUrls: ['./app.component.css']
})
export class LeafletComponent implements OnInit {
constructor() {
}
ngOnInit() {
const map = L.map('map').setView([51.509865,-0.118092],10);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
attribution: '© OpenStreetMap contributors'
}).addTo(map);
}
}
我已经在主要的Angular组件中包含了上面地图的css和html
.formly.component.html
<mat-tab label="AREAS COVERED">
<div id="map"></div>
</mat-tab>
.formly.component.css
div{
height: 500px;
width: 500px;
}
app.module.ts
import { LeafletComponent } from './ang-formly/ang-formly/leaflet-component';
@NgModule({
declarations: [
AppComponent,LeafletComponent,
现在地图没有加载任何人都可以帮助我如何以角度形式添加这个自定义组件
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)