我在我的項目中使用插件ngx-leaflet和angular-cli。'L'是指UMD全局 - 編譯錯誤
我想作爲文檔的描述使用單張,例如:
問題是,當我試圖編譯我得到了以下錯誤:
編譯時間:
ng serve --aot
語境這裏:
我曾嘗試使用導入L
以不同的方式:
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
但我無法找到文件,也沒有任何github。
我沒有刪除所有模塊使用atm編譯,但我需要一個解決方法。
這裏是我使用的package.json:
這裏是我的組件裏面的代碼中,'L'
用戶:
@Component({
selector: 'app-map-screens-element',
templateUrl: './map-screens-element.component.html',
styleUrls: [
'./map-screens-element.component.scss',
],
})
export class MapScreensComponent implements OnInit {
/**
* setting map options
*/
public $mapOptions = {
// we use the layer openstreetmap
layers: [
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'),
],
zoom: 15,
center: L.latLng([48.866667, 2.333333]),
};
}
這裏的進口模塊插入到我的項目中:
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
@NgModule({
imports: [
LeafletModule,
],
declarations: [
// ...
],
exports: [
// ...
],
})
export class SharedElementModule { }
爲什麼我們可以有實際的代碼?這裏的副本將更好 – Vega
我做了一個編輯代碼 –