Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 将材质选择控件绑定到枚举标志_Angular_Typescript_Angular Material2 - Fatal编程技术网

Angular 将材质选择控件绑定到枚举标志

Angular 将材质选择控件绑定到枚举标志,angular,typescript,angular-material2,Angular,Typescript,Angular Material2,如何将绑定到枚举标志 My TypeScript枚举标志的定义如下: export enum CarType { Sedan = 1 << 0, // 001 Coupe = 1 << 1, // 010 Jeep = 1 << 2 // 100 } 现在我想将我的选择框绑定到属性desiredCarType 请查看我的Plunker以获取初始尝试:。我假设我不能直接绑定,但必须以某种方式将属性拆分为一个数组,然后返回 public d

如何将
绑定到枚举标志

My TypeScript枚举标志的定义如下:

export enum CarType {
  Sedan = 1 << 0,  // 001
  Coupe = 1 << 1,  // 010
  Jeep = 1 << 2    // 100
}
现在我想将我的选择框绑定到属性desiredCarType

请查看我的Plunker以获取初始尝试:。我假设我不能直接绑定,但必须以某种方式将属性拆分为一个数组,然后返回

public desiredCarTypes: CarType = CarType.Sedan | CarType.Jeep;