Description

Show or hide element based on expression passed to it.

Usage

as attribute
<ANY show-when="{expression}">
   ...
</ANY>

Parameters

ParamTypeDetails
show-whenexpressionExpression to evaluate.

Example

Source

<p><a href="javascript:void(0);" ng-click="alert()" styling="button">{{foo ? 'Hide' : 'Show'}}!</a> </p>
<h3 show-when="foo" id="example_hello-world">Hello World</h3>
angular.module('lightning')
.controller('ExampleController', ['$scope','$timeout', function($scope,$timeout) {
          $scope.foo = false;
          $scope.alert = function(){
            $scope.foo = !$scope.foo
          };
        }]);

Result

Result