一个按钮的onClick应该显示angularjs并排的div侧 [英] Onclick of a button should display the divs side by side in angularjs

查看:84
本文介绍了一个按钮的onClick应该显示angularjs并排的div侧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按钮的onclick,我试图通过side.I显示div的一侧有一个DIV标题,价值和图形部分。

Onclick of a button,I'm trying to display the div's side by side.I have title,value and graph sections with in a div.

我有一个json.I'm不能亲自到从脚本数据绑定到HTML page.Can任何形式的这些值,请帮我对此...

I have these values in the form of a json.I'm unable to bind the data from script to the html page.Can anyone please help me out regarding this ...

当我点击一个按钮,此数据对于不同divs.How不同,我可以更改分区中的数据。

This data is different for different divs.How can I change the data in the div when I click on a button.

推荐答案

您已经充满了你需要的数据的对象,你只需要将它们添加到阵列进行显示。要做到这一点,你需要跟踪哪些对象要添加。所以,你可以保持你每次添加一个项目时增加一个计数器,那么你可以使用此计数器来选择要添加的对象。

You have the objects filled with the data you need, you just need to add them to the array for display. To do this you will need to keep track of which object you want to add. So you could keep a counter that you increment each time you add an item, then you can use this counter to select the object to add.

,使这项工作将是对所有的商品(而不是仅显示)的一个简单方法可以存储在一个单独的数组。然后,您可以添加物品通过改变你的addItem()函数来像这样显示:

An easy way to make this work would be for all your items (not just the ones to display) to be stored in a separate array. Then you can add the items to display by changing your addItem() function to something like this:

var counter = 0;

 $scope.addItem = function() {
    $scope.items.push($scope.allItems[counter]);
    counter++;
 };

这篇关于一个按钮的onClick应该显示angularjs并排的div侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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