I want to display dropdown options depending on the value I pass in controller
Controller:
This.selectedColumn = label;
This.dditems = [
{
id: 1,
label: 'aLabel',
subItem: 'aSubItem'
},
{
id: 2,
label: 'bLabel',
subItem: 'bSubItem'
},
{
id: 3,
label: 'bLabel',
subItem: 'cSubItem'
}
];
In above code I have selectedColumn as label, then I should display dditems.label in dropdown. If I pass selectedColumn as subItem, then I should display dditems.subItem in dropdown.
Html:
<ul class="dropdown-menu" role="menu" aria-labelledby="single-button" >
<li role="menuitem" data-ng-repeat="item in dc.dditems">
<a>{{ item.label }}</a>
</li>
</ul>
In above code I have hardcoded item.label, so now item.label column is displaying. But I want to display value based on selectedColumn.
Eg: <a>{{ item.selectedColumn }}</a>
How can I do this dynamic way?