显示一个div,同时用ng hide和ng show隐藏另一个div

时间:2016-10-07 10:14:33

标签: angularjs ionic-framework

我有一个按钮,当点击使得div消失与ng-hide但我无法弄清楚当我点击该按钮时我可以使另一个div出现。现在我的代码是这样的:



<div class="col text-center"><button class="button b3" ng-click="goEsconder = !goEsconder">
     Ver fotos
   </button></div>
  </div>
  <div class="row" ng-hide="goEsconder">
    <div class="col tipo"><p class="tip">Tipo de espaço:</p><p class="tip2">Escritório</p>
    <p class="tip">Preço:</p><p class="tip2">{{detalhes[1]}}€/mês</p>

    <div class="col tipo"><p class="tip">Condições:</p>
    <p class="tip2">150 m2 de espaço
configurável</p>
</div>
&#13;
&#13;
&#13; 我的控制器
&#13;
&#13;
.controller('perfilCtrl', ['$scope', '$stateParams', "detailService",// The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams, detailService) {
$scope.detalhes=detailService.data;
$scope.goEsconder = false;
}])
&#13;
&#13;
&#13; 我希望这个div显示何时单击按钮而另一个div隐藏

&#13;
&#13;
  <div class="imagem">
   <img ng-src="http://www.comoditamodulados.com.br/wp-content/uploads/2015/12/executivo_-300x300.jpg" class="img-responsive img-thumbnail">
  </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

<div class="imagem" ng-hide="!goEsconder">
   <img ng-src="http://www.comoditamodulados.com.br/wp-content/uploads/2015/12/executivo_-300x300.jpg" class="img-responsive img-thumbnail">
  </div>

或@Adwaenyth提到。

<div class="imagem" ng-show="goEsconder">
   <img ng-src="http://www.comoditamodulados.com.br/wp-content/uploads/2015/12/executivo_-300x300.jpg" class="img-responsive img-thumbnail">
  </div>