【发布时间】:2018-02-15 23:35:24
【问题描述】:
我在我的项目中使用插件ngx-leaflet 和angular-cli。
我正在尝试使用文档中描述的传单,例如:
问题是当我尝试编译时出现以下错误:
编译:
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 { }
【问题讨论】:
-
为什么我们可以有实际的代码?这里的copypasta会好很多
-
我确实使用代码进行了编辑
标签: angular typescript webpack angular-cli ngx-leaflet