Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

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

I have this error:

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

I'm assigning album variable to the albumData array. Here is the code:

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;
  }

}

What am I doing wrong? Thank you in advanvce!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

 album:any=[]; 

use this code instead of the code you have added

about 4 years ago · Juan Pablo Isaza Denunciar

0

By default, Angular doesn't read the JSON file in the application. So we need to do some extra stuff for that. So we will create a file named 'json-typings.d.ts' inside the app folder of the project.

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

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda