gpt4 book ai didi

javascript - LumX lx-select 不更新 ng-model

转载 作者:行者123 更新时间:2023-12-02 16:39:11 27 4
gpt4 key购买 nike

我最近开始使用 LumX 框架,我尝试使用他们的 Selects 指令 here ,但我不清楚他们的文档。这是我到目前为止所得到的:

        <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-select 的 div 的 Controller 内)

$scope.priorities = [
{ name: 'Urgent', id: 1 },
{ name: 'Very important', id: 2 },
{ name: 'Not important', id: 3 },
{ name: 'None', id: 4 }
];

这确实给了我一个可供选择的列表,但 selectedPriority 模型永远不会更新,因此每当我尝试使用该值时,它总是未定义。我什至无法运行他们在文档页面中提供的示例,但我不确定我缺少什么。

最佳答案

因此以这种方式初始化 selectedPriority 变量:

$scope.selects = {
selectedPriority: undefined,
};

似乎成功了。我尝试在数组内声明 selectedPriority ,但据我所知,这是模型正确更新的唯一方法。

关于javascript - LumX lx-select 不更新 ng-model,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27651125/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com