I'm using a geoJson
to load a world map. I'm testing to see if it works but I'm not getting anything back. I know the file being loaded is correct. What I'm expected is to get the data returned, again to validate things are working. I don't get any errors.
import { Component, OnInit, AfterViewInit } from '@angular/core'; import * as d3 from '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);
});
}
}