Reputation: 1033
I started learning AngularJS but had a little problem.... What is wrong here ? I try to declare songlist as an array with Song Objects but get an error to use "="
import { Song } from './song.model';
export class Chart
{
id:number;
chartName: string;
img: string;
createDate:string;
songList[]: Song;
}
Upvotes: 1
Views: 102
Reputation: 13396
Check out this typescript type definition for arrays.
https://www.typescriptlang.org/docs/handbook/basic-types.html
The syntax for typescript typecasting is
variable: type;
So for an array you'll want something like
songList: Array<Song>;
or
songList: Song[];
Upvotes: 2