generator-angular-2-crud icon indicating copy to clipboard operation
generator-angular-2-crud copied to clipboard

DataModel nested objects

Open almope1516daw2 opened this issue 7 years ago • 1 comments

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?

almope1516daw2 avatar Sep 06 '17 08:09 almope1516daw2

We dont have ComplexType support yet.

You need to do:

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

and inside "Car"

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

gorums avatar Sep 09 '17 19:09 gorums