如何使用新的详细信息删除现有的详细信息 [英] How to remove already existing details with the new one

查看:110
本文介绍了如何使用新的详细信息删除现有的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ionic来显示列表中所选项目的小描述。这里的问题是当选择列表中的item1时它显示其描述,但同时当选择列表中的item2时,它也显示前一个和第二个的描述。我尝试了很多方法,但不能错过这个错误。





Im using ionic to display a small description of the selected item from the list. The problem here is when the item1 from list is selected it displays its description but at same time when the item2 from the list is selected it displays the description of previous one and second one also. I tried many ways but couldn't over come the mistake.


  $scope.items=[];
  $scope.carList = [{ value: "Bmw", description: "Its bmw" },
  { value: "Mercedes", description: "Its Mercedes" },
  { value: "Honda", description: "Its Honda" }];
  $scope.select_item = function (key) {
  $scope.items.push(key);

}







样本工作



我尝试过:



我创建了一个列表,其中包含每个项目的描述,当项目被选中时,它会显示项目的描述。但是无法删除并显示正确描述。




sample work

What I have tried:

I have created a list with description of each item in it, when the item is selected it displays the description of the item.But can't delete and display the description properly .

推荐答案

scope.items = [];
scope.items=[];


scope.carList = [{value: Bmw,description: 它的bmw},
{值: Mercedes,description: 其梅赛德斯},
{值: Honda,描述: 其本田}];
scope.carList = [{ value: "Bmw", description: "Its bmw" }, { value: "Mercedes", description: "Its Mercedes" }, { value: "Honda", description: "Its Honda" }];


scope.select_item = 功能(键){
scope.select_item = function (key) {


这篇关于如何使用新的详细信息删除现有的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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