我将OpenRouteService添加到我的Stackbliz应用程序中,但它无法工作。该组件如下所示:
import { Component, OnInit } from '@angular/core';
import {Location} from '@angular/common';
import {Openrouteservice} from '/openrouteservice-js/dist/ors-js-client';
@Component({
selector: 'app-event-plan',
templateUrl: './event-plan.component.html',
styleUrls: ['./event-plan.component.scss']
})
export class EventPlanComponent implements OnInit {
constructor(private _location: Location) {
console.log("++++")
console.log(Openrouteservice)
}
ngOnInit() {
}
backClicked() {
this._location.back();
}
},我的问题是,它只是没有得到加载。我将其作为依赖项添加到依赖项部分中。。
我公开了这个项目,这里是url - https://stackblitz.com/edit/angular-micwge?file=src%2Fapp%2Fevent-plan%2Fevent-plan.component.ts。
发布于 2019-12-27 09:46:57
您必须改变import库的方式。import当前的方法是从库中寻找一个命名的导出。
如果您的allowSyntheticImports和esModuleInterop在您的tsconfig.json中,请使用以下命令:
import Openrouteservice from 'openrouteservice-js';否则:
import * as Openrouteservice from 'openrouteservice-js';找到你的叉形堆垛
https://stackoverflow.com/questions/59494762
复制相似问题