top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What directives are used to show and hide HTML elements in AngularJS?

0 votes
307 views
What directives are used to show and hide HTML elements in AngularJS?
posted Oct 16, 2017 by Sathaybama

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

ng-show and ng-hide directives are used to show and hide HTML elements in the AngularJS based on an
expression. When the expression is true for ng-show or ng-hide, HTML element(s) are shown or hidden from the
page. When the expression is false for ng-show or ng-hide, HTML element(s) are hidden or shown on the page.

<div ng-controller="MyCtrl">
 <div ng-show="data.isShow">ng-show Visible</div>
 <div ng-hide="data.isHide">ng-hide Invisible</div>
</div>
<script>
 var app = angular.module("app", []);
 app.controller("MyCtrl", function ($scope) {
 $scope.data = {};
 $scope.data.isShow = true;
 $scope.data.isHide = true;
 });
</script>
answer Oct 16, 2017 by Shivaranjini
...