Я использую geoJson
для загрузки карты мира.Я проверяю, работает ли это, но я ничего не получаю обратно.Я знаю, что загружаемый файл правильный.Я ожидаю, что данные будут возвращены, чтобы подтвердить, что все работает.Я не получаю каких-либо ошибок.
import {Component, OnInit, AfterViewInit} из '@ angular / core';импорт * как d3 из 'd3';
@Component({
selector: 'app-map',
templateUrl: './map.component.html',
styleUrls: ['./map.component.scss']
})
export class MapComponent implements OnInit, AfterViewInit {
private svg;
private width;
private height;
private features;
constructor() { }
ngOnInit() {
}
ngAfterViewInit() {
this.svg = d3.select("svg");
this.height = this.svg.attr("height");
this.width = this.svg.attr("width");
this.features = this.svg.append("g")
d3.json("/assets/files/views/maps/world.json", function(error, mapData) {
console.log(mapData.features);
});
}
}