generator-angular-2-crud
generator-angular-2-crud copied to clipboard
DataModel nested objects
I have this object at the DataModel.
"Car": {
"id": { "key": "true" },
"ip": { "type": "string", "require": "true" },
"name": { "type": "string", "require": "true" },
"location": {
"latitude": "number",
"longitude": "number"
},
"model": "string",
"brand": "string"
}
The problem is at the "location" object. This gives me at the Typescrypt model:
export interface CarModel {
id : string;
ip : string;
name : string;
location ? : [object Object];
model ? : string;
brand ? : string;
}
the "[object Object]" part is giving me this error at npm start:
[at-loader] src/app/models/car.ts:5:25
',' expected.
how can I solve it?
We dont have ComplexType support yet.
You need to do:
"Locations": { "latitude": "number", "longitude": "number" }
and inside "Car"
... "LocationId": { "referent": "Locations", "render": "latitude" }