JSON的数据复制问题 [英] Data duplicating issue with JSON

查看:177
本文介绍了JSON的数据复制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have included the code in http://codepen.io/sajoambattu/pen/MbezNa

我有3个div,每个div包括颜色选择,内存和通话计划.通话计划数据位于每个设备详细信息之后(在表格之后).

I have 3 divs in which each div includes color selection, Memory and call plans. The call plans data is there after every device details(after the table).

所有数据均取决于3个JSON.颜色选择和内存数据来自设备JSON,而呼叫计划数据来自呼叫计划JSON.我还有另一个用于映射设备和呼叫计划的JSON(planMapping).我在JS文件中包含的所有JSON.

All the data are depending on 3 JSONs. The color selection and Memory data is coming from devices JSON and call plans data is coming from callplans JSON. I have another JSON(planMapping) for mapping the device and call plan. All JSON's I have included in the JS file.

我的要求基于用户对颜色和内存的选择,应显示相应的呼叫计划.现在正在显示内容,但是我面临的问题是它在所有三个部分(Apple,Samsung和Sony)中都显示相同的内容.

My requirement is based on the user selection of color and memory, respective call plans should display. Now the content is displaying, but the problem I'm facing is it's displaying the same content in all three sections(Apple, Samsung and Sony).

问题示例:

单击苹果部分中的iPhone 6s plus选项卡,然后单击32GB内存,然后单击任何颜色,现在将显示iPhone 6s plus通话计划.问题在于,所有其他部分也都显示了相同的iPhone 6s和通话计划数据.

Click iPhone 6s plus tab from the apple section and click on 32GB memory and then click any color, now iPhone 6s plus call plans will display. The problem is the same iPhone 6s plus call plans data is getting displayed in all other sections as well.

任何帮助将不胜感激.

推荐答案

我已经更新了您的代码....

I have updated your code....

http://codepen.io/anon/pen/dOpdXr

更改:

HTML:

<div class="planDetails" ng-repeat="data in x.callPlanArr">

并还移动了< div class ="device_overview {{x.memory}}-{{x.presales_name.split('').join('-').replace('(',').replace('''','')}}" ng-repeat ="x in v | orderBy:'memory'" ng-show ="$ first> 移至修改后的div的末尾.

and also moved </div> of <div class="device_overview {{x.memory}}-{{x.presales_name.split(' ').join('-').replace('(','').replace(')','')}}" ng-repeat="x in v | orderBy:'memory'" ng-show="$first"> moved to end of the modified div.

JS:

 item.callPlanArr = []; //at line 5770                               

item.callPlanArr.push($scope.callplanList.callplans[x]); //5784

这篇关于JSON的数据复制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆