import {Place} from "../models/place";
import {Location} from "../models/location";
export class PlacesService {
private places: Place[] = [];
addPlace(title: string,
description: string,
location: Location,
base64Image: string){
***let place = new place(title,description,location,base64Image);***
this.places.push(place);
}
loadPlaces(){
return this.places.slice();
}
}
答案 0 :(得分:0)
本声明
let place = new place
^^^^^ ^^^^^
会引发错误,因为您要创建place
的实例,该实例在构造函数中被声明为变量,并且您没有初始化它。您的模型名称为Place
(第一个字母为大写),而不是place
。
let place = new Place(...)