从页面的JSON加载显示数据时出现问题 [英] Issue when displaying data from JSON onload of the page

查看:252
本文介绍了从页面的JSON加载显示数据时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

默认情况下,需要在所有区域(苹果,三星,索尼)中显示第一个相关的呼叫计划数据(第一个颜色,第一个内存).

By default need to display the first related call plans data(first color, first memory) in all sections(apple, samsung, sony).

现在,在对onclick函数正确的内存和颜色部分onclick之后,它就可以工作了.我唯一的要求是在加载页面后显示第一个相关的呼叫计划数据.

Now it's working after onclick of the memory and color section which is correct for onclick function. My only requirement is to display the first related call plans data after loading the page.

示例:

在苹果部分,需要显示16gb和与第一个颜色(银色)相关的通话计划.

In apple section, need to display 16gb and first color(Silver) related call plans.

在三星部分,需要显示32gb和与第一个颜色(金白金)相关的通话计划.

In samsung section, need to display 32gb and first color(Gold platinum) related call plans.

任何帮助将不胜感激.

推荐答案

使用ng-init()方法并加载第一个元素

Use ng-init() method and load the first element

<p ng-repeat="x in v | orderBy:'memory'" ng-init="loadFirstItem()" ng-click="showDataMemory(((x.memory+' ')+(x.presales_name)).split(' ').join('-').replace('(','').replace(')',''))">{{x.memory}}GB</p>

请找到有用的塞子 https://plnkr.co/edit/PpWrCJALovStcE4FRM33?p=preview

这篇关于从页面的JSON加载显示数据时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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