我有這個錯誤:
Type {...} is missing the following properties from type 'any[]': length,pop,push,concat, and 28 more
我將專輯變數分配給專輯資料陣列。這是代碼:
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;
}
}
我究竟做錯了什么?預先感謝您!
uj5u.com熱心網友回復:
album:any=[];
使用此代碼而不是您添加的代碼
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/436157.html
標籤:javascript 有角度的
上一篇:從資料庫角度回傳單個用戶屬性
