我最近开始使用LumX框架,我试图使用他们的Selects指令这里,但我不清楚他们的文档。到目前为止,这就是我所得到的:
<lx-select ng-model="selectedPriority" placeholder="Priority" choices="priorities">
<lx-select-selected>
{{ $selected.name }}
</lx-select-selected>
<lx-select-choices>
{{ $choice.name }}
</lx-select-choices>
</lx-select>这就是我如何定义优先级的方法(在包含lx的div控制器中)
$scope.priorities = [
{ name: 'Urgent', id: 1 },
{ name: 'Very important', id: 2 },
{ name: 'Not important', id: 3 },
{ name: 'None', id: 4 }
];这确实为我提供了一个可供选择的列表,但selectedPriority模型从未得到更新,因此每当我尝试使用该值时,它总是未定义的。我甚至不能运行它们在文档页面中提供的示例,但我不确定我缺少了什么。
发布于 2014-12-30 20:27:02
因此,以这种方式初始化selectedPriority变量:
$scope.selects = {
selectedPriority: undefined,
};似乎起了作用。我试图在数组中不声明selectedPriority,但据我所知,这是正确更新模型的唯一方法。
发布于 2015-03-24 09:10:10
检查您的角度版本,看看它是否符合您的lumX版本的最低要求。
例如,lumX的0.3.24版本和example的1.2.28版本的匹配将产生您所遇到的问题(模型不会更新),就我所做的实验而言。
https://stackoverflow.com/questions/27651125
复制相似问题