首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Stackbliz上的角应用中加入OpenRouteService

在Stackbliz上的角应用中加入OpenRouteService
EN

Stack Overflow用户
提问于 2019-12-27 00:28:06
回答 1查看 371关注 0票数 2

我将OpenRouteService添加到我的Stackbliz应用程序中,但它无法工作。该组件如下所示:

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-12-27 09:46:57

您必须改变import库的方式。import当前的方法是从库中寻找一个命名的导出。

如果您的allowSyntheticImportsesModuleInterop在您的tsconfig.json中,请使用以下命令:

代码语言:javascript
复制
import Openrouteservice from 'openrouteservice-js';

否则:

代码语言:javascript
复制
import * as Openrouteservice from 'openrouteservice-js';

找到你的叉形堆垛

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59494762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档