Angularjs - dynamic ng-options

后端 未结 2 1696
你的背包
你的背包 2020-12-16 00:21

For the need of a directive i\'m writing, i have to construct dynamically the ng-options expression. Here is what i tried.

In my directive:

// ... s         


        
2条回答
  •  孤街浪徒
    2020-12-16 01:07

    Change your code to look like this (use javascript to pick your property):

    // ... scope.labelProperty = 'name';
    scope.selectOptions = "l[labelProperty] for l in list";
    
    
    

提交回复
热议问题