我会这样:
Select an option
{{obj.viewValue}}
Code for Input Box of Individual Customer
Code for Combo Box of Organizational Customer
Favorite food
{{food.viewValue}}
TS代码:
import { Component } from '@angular/core';
@Component({
selector: 'select-overview-example',templateUrl: 'select-overview-example.html',styleUrls: ['select-overview-example.css'],})
export class SelectOverviewExample {
list: any[] = [
{ value: 'indCust',viewValue: 'IndividualCustomer' },{ value: 'orgCust',viewValue: 'Organizational Customer' }
];
foods: any[] = [
{ value: 'steak-0',viewValue: 'Steak' },{ value: 'pizza-1',viewValue: 'Pizza' },{ value: 'tacos-2',viewValue: 'Tacos' }
];
isSelected: boolean = false;
indCust: Boolean = undefined;
get(data) {
this.isSelected = true;
if (data.value == 'indCust') {
this.indCust = true;
console.log(data)
} else {
this.indCust = false;
}
}
}