I'm starting to learn angular. I'm trying to occupy the datatables library that I use in other projects with other languages. By reading the documentation here: https://l-lin.github.io/angular-datatables/#/basic/with-ajax. But I have not managed to access the information in the static json file.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
dtOptions: DataTables.Settings = {};
ngOnInit(): void {
this.dtOptions = {
ajax: 'data/data.json',
columns: [{
title: 'ID',
data: 'id'
}, {
title: 'First name',
data: 'firstName'
}, {
title: 'Last name',
data: 'lastName'
}]
};
}
}
the problem is in the ajax call (I think), but I tried:
'./data/data.json'
'..data/data.json'
'data/data.json'
html
<table datatable [dtOptions]="dtOptions" class="row-border hover"></table>
Console:
And many other things but I can not get to the result, it's the first time I spend so much time solving something with this library :(

