gorums / generator-angular-2-crud

This app generate a CRUD for Angular2
https://www.atomicg.dev/
Other
33 stars 17 forks source link

DataModel nested objects #16

Open almope1516daw2 opened 7 years ago

almope1516daw2 commented 7 years ago

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?

gorums commented 7 years ago

We dont have ComplexType support yet.

You need to do:

"Locations": { "latitude": "number", "longitude": "number" }

and inside "Car"

... "LocationId": { "referent": "Locations", "render": "latitude" }