2014-12-25 20 views
0

我最近开始使用LumX框架,我试图用自己的选择指令here,但我不是他们的文档清晰。这是我到目前为止有:LumX LX-选择不更新NG-模式

 <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> 

这就是我如何确定优先事项(控制器内的DIV包含LX-选择)

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

这确实给我列表从中选择,但selectedPriority模型永远不会被更新,所以,每当我尝试使用该值,它总是不确定的。我甚至不能运行他们的文档页面提供的例子,但我不知道我错过了什么。

回答

2

所以初始化变量selectedPriority这样:

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

似乎这样的伎俩。我试着不声明数组内selectedPriority但据我所知,这是该模型被正确地更新的唯一途径。

0

检查您的角度版本,看它是否符合你的lumX版本的最低要求。

。例如lumX的0.3.24版本的角度1.2.28版本的匹配会产生正是您所遇到的问题(型号将不会更新),据我已经尝试。