typescript read json file
"resolveJsonModule": true,
"esModuleInterop": true,
typescript read json file
"resolveJsonModule": true,
"esModuleInterop": true,
get data from json file angular
/*--IN THE TS OF THE COMPONENT--*/
//In imports section
import variableName from '../../assets/fileName.json';
//In the class part of the same file
export class AppComponent {
//This variable will have all the values
public nameList:{field1:type, field2:type}[] = variableName;
}
/*--IN A NEW TS FILE--*/
//Create another js file in the app folder with
declare module "*.json" {
const value: any;
export default value;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us