Angular - ng-show and ng-hide

by Marventus

HTML

<div ng-app="myApp">
  <div ng-controller="myController">
    <p ng-show="showText" ng-bind="text1"></p>
    <p ng-hide="showTextFn()" ng-bind="text2"></p>
    <input type="checkbox" ng-model="showText" />
  </div>
</div>

JavaScript

var myApp = angular.module("myApp", []);
myApp.controller("myController", ["$scope", function($scope) {
  $scope.showText = true;
  $scope.text1 = "Mi texto";
  $scope.text2 = "Mi otro texto";
  $scope.showTextFn = function() {
    return $scope.showText;
  };
}]);