ng-show clarification
HTML
<div ng-controller="Ctrl">
<form>
<div><input type="button" id="DisplayButton" value="NG-SHOW/NG-HIDE Sections" ng-click="changeDisplaySections()" />
<input type="button" id="DisplayButton" value="NG-SHOW/NG-HIDE Phone Options" ng-click="changeDisplayPhoneOptions()" />
<div id="displaySectionId" ng-show="displaySections">
<input type="button" id="show-section1" value="Section 1" ng-click="section1=!section1" />
<input type="button" id="show-section2" value="Section 2" ng-click="section2=!section2" />
<input type="button" id="show-section3" value="Section 3" ng-click="section3=!section3" />
</div>
</div>
<div id="rule-option-modal" ng-show='displayPhoneOptions'>
<button class="rule-option" ng-repeat="pob in phoneOptionButtons">
<div class="{{ pob.name | lowercase }}">{{ pob.name }}</div>
</button>
</div>
</form>
<section id="section1" ng-show="section1">blah</section>
<section id="section2" ng-show="section2">blah2</section>
<section id="section3" ng-show="section3">blah3</section>
</div>
JavaScript
'use strict';
var App=angular.module('myApp',[]);
function Ctrl($scope){
$scope.displayPhoneOptions = false;
$scope.phoneOptionButtons = [
{name:'CVOIP'},
{name:'Home'},
{name:'Cell'},
{name:'Work'}
];
$scope.displaySections = true;
$scope.changeDisplaySections = function () {
alert('displaySections: ' + $scope.displaySections);
if($scope.displaySections === false) {
alert('turning on displaySections');
$scope.displaySections = true;
}
else {
alert('turning off displaySections');
$scope.displaySections = false;
}
}
$scope.changeDisplayPhoneOptions = function () {
alert('displayPhoneOptions: ' + $scope.displayPhoneOptions);
if($scope.displayPhoneOptions === false) {
alert('turning on displayPhoneOptions');
$scope.displayPhoneOptions = true;
}
else {
alert('turning off displayPhoneOptions');
$scope.displayPhoneOptions = false;
}
}
}