In my app, I have a model defined as Class with a constructor. Like this:
export class Movie {
title: string;
posterURL: string;
description: string;
public constructor(cfg: Partial<Movie>) {
Object.assign(this, cfg);
}
getEndDate(): Date {
return new Date();
}
};
I also have an HTTP request that uses this model
getMoviesData(): Observable<Movie[]> {
return this.http.get<Movie[]>(`http://localhost:3544/movies`)
}
As expected, it doesn't work
How can I solve this? Should I also create an interface or what?
Thanks for the help :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…