0
输入我在我的视图遍历这个数组angularjs在我的角度控制器的范围不更新在移动
$scope.items = [
{Name: 'X'},
{Name: 'Y'},
{Name: 'Z'}
];
$scope.currentItemIdx = 0;
$scope.currentItem = $scope.items[$scope.currentItemIdx];
function setCurrent(){
$scope.currentItemIdx++;
$scope.currentItem = $scope.items[$scope.currentItemIdx];
}
数组和变量我有结合到CURRENTITEM输入
<input type="number" class="form-control" ng-model="currentItem.Name">
并在桌面上一切正常 - 当我打电话setCurrent()
currentItem前进和输入值是:然后Y然后Z
问题开始wh我在移动设备上的Chrome中运行此功能 - 有时输入会显示正确的名称,有时它不会更新。例:
currentItemIdx = 0
,输入值X
我打电话setCurrent()
currentItemIdx = 1
,输入值为Y
我打电话setCurrent()
currentItemIdx = 2
,输入值是Y,但是当我集中输入(轻敲)的值变化到Z
我试着在setCurrent()
加入$scope.$apply()
- 不工作
我也试过在输入不显示名称
<div>{{currentItem.Name}}</div>
它显示正确的值! (右边输入不正确的值)
所以它好像只是一些输入ngmodel-refreshTheValue问题
有没有人有类似的问题?
nope。没有帮助 – seishin 2014-09-29 18:45:44