Hello, members of the Angularjs Technorati. I come to you today as a novice
trying to make div panels hide and show, using $scope switching in a
bolean statement. Here is the code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="Portal Associates" />
<title>Untitled 33</title>
<script type="text/javascript" src="angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="showDiv">
<div class="block">START HERE!<div>
<button class="" ng-click="getPanel_1">Button1</button>
<button class="" ng-click="getPanel_2">Button2</button>
<button class="" ng-click="getPanel_3">Button3</button>
<div ng-show="divA">con1</div>
<div ng-show="divB">con2</div>
<div ng-show="divC">con3</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('showDiv', function($scope) {
var getPanel_1 = $scope.view;
if (getPanel_1 === true) {
$scope.divA = true;
$scope.divB = false;
$scope.divC = false;
}
var getPanel_2 = $scope.view;
if (getPanel_2 === true) {
$scope.divA = false;
$scope.divB = true;
$scope.divC = false;
}
var getPanel_3 = $scope.view;
if (getPanel_3 === true) {
$scope.divA = false;
$scope.divB = false;
$scope.divC = true;
}
}
</script>
</body>
</html>
Please show me the error in my logic and demonstrate the proper code.
Thanks in advance,
Batoe.
ps: "The road to success is filled with obstacles, but also success!"
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.