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

122
Views
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 answers
Answer question

0

 album:any=[]; 

use this code instead of the code you have added

about 4 years ago · Juan Pablo Isaza Report

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 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!