3
I need to hide fields using Angular JS
, after clicking a button will be displayed to label
down below:
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body ng-app="">
<div>
<input type="button" ng-model="btnArea" ng-init="btnArea = true" value="Áreas">
<input type="button" ng-model="btnPonto" ng-init="btnPonto = true" value="Pontos">
</div>
<div ng-if="btnArea">
<h1>Áreas</h1>
<p>Welcome to my Áreas.</p>
<hr>
</div>
<div ng-if="btnPonto">
<h1>Pontos</h1>
<p>Welcome to my Pontos.</p>
<hr>
</div>
Link: Jseddle
How to hide the other field ??
– alexjosesilva
@alexjosesilva then, each button has its own
ng-click
that controls the display of the corresponding div.– celsomtrindade
happens that it is displayed the two fields at the same time...
– alexjosesilva
It happens that in the example is being displayed both at the same time...
– alexjosesilva
@alexjosesilva But what do you want to do? display only one or the other?
– celsomtrindade
The initial idea is to display only the field after clicking the button and hiding another field...some @celsomtrindade tip
– alexjosesilva
@alexjosesilva updated my answer, see if this is what you seek.
– celsomtrindade