I started to learn typescript --angular, I want to read a json file.
my json file look like this :
{
"nb": "7",
"extport": "1176",,
"REQ_EMAIL": "[email protected]",
"DIGEST": "sha512",
"password": "@mypassword",
"ip": "8.8.8.8",
"name": "@myname",
"version": "v3.0.2"
}
my component ts code : i tried to create a variable to read my jsonfile :
import { Component, Input, OnInit } from '@angular/core';
import * as param from '../../data/setup.json'
interface Setup {
number: string;
port: string;
email: string;
password: string;
}
@Component({
selector: 'app-appareils',
templateUrl: './appareils.component.html',
styleUrls: ['./appareils.component.scss']
})
export class AppareilsComponent implements OnInit {
constructor() {}
data: Setup[] = param ;
ngOnInit(): void {}
}
but i got error on the variable data created : is missing the following properties from type 'Setup[]': length, pop, push, concat, and 29 more.
how i can fix it to use this variable on the html file ?
thank you