Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Al tipo {...} le faltan las siguientes propiedades del tipo 'any[]': length,pop,push,concat y 28 más

tengo este error:

 Type {...} is missing the following properties from type 'any[]': length,pop,push,concat, and 28 more

Estoy asignando una variable de álbum a la matriz albumData. Aquí está el código:

 import { Component, OnInit } from '@angular/core'; import albumData from '../data/SearchResultsAlbum.json'; @Component({ selector: 'app-album-component', templateUrl: './album-component.component.html', styleUrls: ['./album-component.component.css'] }) export class AlbumComponentComponent implements OnInit { album:Array<any>=[]; constructor() { } ngOnInit(): void { this.album=albumData; } }

¿Qué estoy haciendo mal? ¡Gracias de antemano!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

 album:any=[];

use este código en lugar del código que ha agregado

about 4 years ago · Juan Pablo Isaza Report

0

De forma predeterminada, Angular no lee el archivo JSON en la aplicación. Así que tenemos que hacer algunas cosas extra para eso. Así que crearemos un archivo llamado 'json-typings.d.ts' dentro de la carpeta de la aplicación del proyecto.

 declare module "*.json" { const value: any; export default value; }

fuente: https://jsonworld.com/demo/how-to-read-local-json-file-in-angular

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!