I am trying to make the ng-hide or ng-show in Angular working based on a $scope variable.
The Hello
What am I doing wrong?
Controller:
angular
.module('myApp', [])
.controller('MainController', MainController);
function MainController($scope) {
$scope.state = true;
}
Html:
<body ng-controller="MainController">
<h1>Hello Plunker!</h1>
<div ng-hide"state">
<p>hello</p>
</div>
{{ state }}
</body>
Plunker link https://plnkr.co/edit/xxWVeThH8m218aS4Dago?p=preview
You need to make it ng-hide="state".
You're missing the equals sign.
<body ng-controller="MainController">
<h1>Hello Plunker!</h1>
<div ng-hide="state">
<p>hello</p>
</div>
{{ state }}
</body>
Here's your plunker, fixed. https://plnkr.co/edit/5BY0ubF3X70yFGVVd0Po?p=preview