Home Object as a select value in Angular 2
Reply: 1

Object as a select value in Angular 2

Mario López
1#
Mario López Published in 2018-01-12 11:39:09Z

JSON Object

export class Car {
  ID: String;
  dors: [{
    number: Number,
    postion: {
        x: String,
        y: String,
        z: String,
    }
  }]

}

How do I set position as the value of a Select? I have tried value={{}} but it can only be used for a string. I have tried ngValue but it seems not to change the behavior. It keeps bringing just the string that I show in the select so I got not the correct way to do it. Is it possible?

I want to set car.dors.position as a value.

What I need to do is something like this:

I get all the information of the object, but I want to get car.doors[i] as a value.

Sam Pasku
2#
Sam Pasku Reply to 2018-01-12 14:56:27Z
export class Car {
  ID: String;
  dors:Array<any>= [{
    number: Number,
    postion: {
        x: String,
        y: String,
        z: String,
    }
  }]

}

read more about class definitions https://www.typescriptlang.org/docs/handbook/classes.html

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.383648 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO