Angular - ng-show and ng-hide
by Alejandro M
HTML
<div ng-app="myApp">
<div ng-controller="myController">
<!-- true/false -->
<p ng-show="!showText" ng-bind="text"></p>
<!-- expresiones -->
<p ng-show="text == 'Mi texto'" ng-bind="text"></p>
<!-- función -->
<p ng-hide="showTextFn()" ng-bind="text"></p>
</div>
</div>
JavaScript
var myApp = angular.module("myApp", []);
myApp.controller("myController", ["$scope", function($scope) {
$scope.showText = true;
$scope.text = "Mi texto";
$scope.showTextFn = function() {
return $scope.showText;
};
}]);