纳克模型数据不所选纳克选项结合
HTML
<select
ng-model="selected1"
ng-options="item.Name as item.Name for item in jobLineClassFSC"
class="gridinputs">
</select>
<select
ng-model="selectedJobLineTypeFSC"
ng-options="item.Name as item.Name for item in jobLineTypeFSC">
</select>
<select
ng-model="selectedJobLineSubTypeFSC"
ng-options="item.Name as item.Name for item in jobLineSubTypeFSC">
我得到的结果并正确显示;但选择列表是没有得到绑定到NG-模式,我不知道为什么。我实现在我的项目另一个地方它的工作在那里一样。任何人都可以请让我知道该怎么做。任何帮助将是非常美联社preciated。
I'm getting the result and display it properly; but the selected list is not getting bound to the ng-model and I don't know why. I implemented the same in another place in my project it's working over there. Can anyone please let me know how to do that. Any help will be really appreciated.
我的猜测是你的选择标记在不同范围控制器。因此, NG-模型
店选择了错误的范围内的值。
My guess would be your select tags are in different scope to your controller. So the ng-model
store selected values inside the wrong scope.
要避免这种情况最好的做法是用点符号如 model.selectedJobLineTypeFSC
:
To avoid this the best practice is to use the dot notation like model.selectedJobLineTypeFSC
:
<select ng-model="model.selectedJobLineTypeFSC"
ng-options="item.Name as item.Name for item in jobLineTypeFSC"></select>
并在控制器检查 $ scope.model.selectedJobLineTypeFSC
代替。