根据angularjs

时间:2016-10-13 07:19:17

标签: angularjs ionic-framework

我是Angular / Ionic的新手。我有如下创建的离子列表。我想在列表中显示/隐藏项目取决于item.display可变的值。我的代码如下所示

<ion-list id="item-list7" ng-repeat="item in items track by $index" >

//below item should display or hide with respect to value in item.display
<ion-item  id="item{{item.id}}" class="item-thumbnail-left assertive" >
{{item.item_name}}
</ion-item>

<ion-list>

提前致谢。任何帮助都会很明显。

1 个答案:

答案 0 :(得分:0)

只需使用div / More info on MSDN,就像这样:

<强> NG-展示

<ion-item ng-if="item.display" id="item{{item.id}}" class="item-thumbnail-left assertive" >

<强>纳克隐藏

{
    "InfoList":  {
        "Name": " Sample String 1",
        "URL": " Sample String2",
        "Info": [
            {
                "ZIP": " Sample String3 ",
                "status": "Sample String4"
            }
        ]
    }
}

您也可以使用this question来隐藏元素,但要注意:它也会将其从DOM中删除。

<强> NG-如果

public class Rootobject
{
    public Infolist InfoList { get; set; }
}

public class Infolist
{
    public string Name { get; set; }
    public string URL { get; set; }
    public Info[] Info { get; set; }
}

public class Info
{
    public string ZIP { get; set; }
    public string status { get; set; }
}