【问题标题】:AngularJs and ionic. ion-slide-box with ng-repeatAngularJs 和离子。带有 ng-repeat 的离子滑块
【发布时间】:2016-03-11 19:02:08
【问题描述】:

我在使用<ion-slide-box> 时遇到了一个奇怪的问题。 在浏览器和 android 上,它看起来应该是这样。 但在 IOS 9.2 上,它重复或因错误重复索引而中断。我这样设置轨道:

<ion-slide ng-repeat="vehicle in vehicles track by vehicle.spot_id">

这给出了重复索引错误

像这样

<ion-slide ng-repeat="vehicle in vehicles track by $index">

这复制了整个车辆对象

有人遇到过这个问题并知道如何解决吗?

谢谢

【问题讨论】:

    标签: ios angularjs cordova ionic-framework angularjs-ng-repeat


    【解决方案1】:

    所以最后我有一个divion-slides 有同样的问题。

    我对此问题的解决方案是遍历对象并将key, value 分配给一个新对象

    $scope.vehiclesHolder = returnData; 
    $scope.vehicles = [];
    angular.forEach($scope.vehiclesHolder, function(value, key) {
        $scope.vehicles[key] = value;
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      • 1970-01-01
      • 2015-03-17
      • 2013-03-15
      • 2016-07-10
      • 1970-01-01
      相关资源
      最近更新 更多