【问题标题】:How to add and hide item in ionic?如何在离子中添加和隐藏项目?
【发布时间】:2015-12-29 14:57:17
【问题描述】:

我有一个侧边菜单,我想更改这侧的项目

例如:如果用户是连接 ==> 项目我的帐户是显示

但是如果用户没有连接 ==>项目我的帐户是隐藏的

在我的控制器中:

facebookExample.controller("accueilController", function($scope, $cordovaOauth, $localStorage, $location,$ionicPopup,$state,$http) {

$scope.connect=true;
$localStorage.connect=true;

在 index.html 中:

<body ng-app="starter" ng-controller="accueilController" >
    <ion-item class="item" nav-clear menu-close href="#/login" ng-show="connect=='true'">
                             <i class="fa fa-user" style="padding-right: 190px;"></i> <div style="padding-left: 25px;padding-top: 5px;">My account  </div>                   
                            </ion-item>

我什么也没找到,我能做什么,我使用 ng-if 或 ng-how 以及如何??

请帮帮我

【问题讨论】:

  • 你试过了吗..你的最后一个问题是ans..!和this..!是一样的..kind!

标签: angularjs cordova ionic-framework residemenu


【解决方案1】:

尝试在 ng-show 中删除该检查

<body ng-app="starter" ng-controller="accueilController" >
<ion-item class="item" nav-clear menu-close href="#/login" ng-show="connect">
  <i class="fa fa-user" style="padding-right: 190px;"></i>
  <div style="padding-left: 25px;padding-top: 5px;">My account</div>                   
</ion-item>

【讨论】:

  • 对于您的代码,我显示我的帐户项目,但如果 connect =false ,我总是显示
  • 检查这个:jsbin.com/lasadeg/edit?html,js,output 问题可能出在代码的其他部分。
猜你喜欢
  • 2018-10-30
  • 1970-01-01
  • 2019-01-19
  • 2016-07-02
  • 2017-08-06
  • 1970-01-01
  • 2019-02-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多