4Manuals

  • PDF Cloud HOME

在Stackblitz上将MapBoxDirections添加到Angular Application中不起作用 Download

    CSS / JS-如何覆盖一个孩子而不是其他孩子的父母过渡 反应:更改方向后触发重新渲染和offsetWidth的重新计算 我的Javascript从'string'转换为'integer'或'number'无效 如何将动态模板引用Click事件绑定到跨度? 如何删除外部索引并合并内部json 在React Native 图片无法通过javascript刷新 Jspdf在最新的Chrome版本中保存时间过长(79.0.3945.88) 如何在react图表上的datakey中操作DateTime 在Cypress中保存变量

我试图将MapboxDirections添加到我的应用程序中,并始终收到错误“找不到包:事件”。显示没有方向插件的地图不会出现任何问题。

我不知道该怎么办,因为一切都似乎安装正确了。

我的package.json:

{
[...],
"dependencies": {
"@angular/[...]",
"@mapbox/mapbox-gl-directions": "^4.0.3",
"@mapbox/polyline": "^1.1.0",
"core-js": "2.6.11",
"corslite": "0.0.7",
"hammerjs": "2.0.8",
"mapbox-gl": "1.6.1",
"rxjs": "6.5.3",
"tslib": "1.10.0",
"zone.js": "0.9.1"
 },
 "scripts": {
   [...]
 },
 "devDependencies": {
"@angular[...]",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.1.1"
 }
}

我的组件:

[...]

import mapboxgl from 'mapbox-gl';
import {MapboxDirections} from '@mapbox/mapbox-gl-directions';

@Component({
    [...]
})
export class HistoryViewComponent implements OnInit {
 history = History;

  constructor(private _bottomSheet: MatBottomSheet) {
}

ngAfterViewInit(){
setTimeout(()=>
  var centerLatLang = new mapboxgl.LngLat(16.3595973, 48.196124);
  mapboxgl.accessToken = 'xxxxxxxx';
  const map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/mapbox/streets-v9',
    center: centerLatLang,
    zoom: 12
  });

  map.addControl(
  new MapboxDirections({
    accessToken: mapboxgl.accessToken
    }),
    'top-left'
  );

  }, 8000);
}
[...]

0 个答案:

没有答案



Similar searches
    如何将文件中的单行保存为两个不同的字符串-结构>>行格式(NAME#SURNAME AGE) Selenium-EventFiringWebDriver beforeFindBy和afterFindBy方法多次触发同一事件 mysqli_query()返回mysqli_result,但是我得到“ mysqli_fetch_array()期望参数1为mysqli_result”错误 共同打印数组名称 保存编码器解码器的模型