Hi Experts,
I am newbie to Angular and have a requirement to show the content based on dropdown value in Angular.I have following dropdown values
None: show no content
Name: Show "Name" content only
Address:Show "Address" content only
All: Show both "Name" and "Address" contents.
I have below code developed in Visual Studio editor which is working fine (UI screenshots attached ) using Angular,Bootstrap and HTML5.
I need sample working code for my requirement.
<div class="container" >
<div style="padding:50px;" ng-controller="samplecontroller">
<div class="row">
<label class="col-lg-2">
Status</label>
<div class="col-lg-5">
<select class="input-sm">
<option selected value="none">None</option>
<option value="name">Name</option>
<option value="address">Address</option>
<option value="all">All</option>
</select>
</div>
</div>
</br>
<div class="row">
<label class="col-lg-2">
Name</label>
<div class="col-lg-5">
<p class="form-group">
{{name}}</p>
</div>
</div>
</br>
<div class="row">
<label class="col-lg-2">
Address</label>
<div class="col-lg-5">
<p class="form-group">
{{address}}</p>
</div>
</div>
</div>
</div>
Select all Open in new window
<script type="text/javascript">
function samplecontroller($scope) {
$scope.name = "FOO";
$scope.address = "ADDRESS1";
}
Select all Open in new window
Thanks in Advance
image1.JPG
image2.JPG
Open in new window
In reality, I have 6 dropdown values and 5 divs in a page layout and based on selection I am displaying divs (none,1,2,3 etc). So the above approach (using ng-hide declaratively on each div) is the best practice in angular ?
Thanks in Advance