user2010243 user2010243 - 1 year ago 201
AngularJS Question

check the expression value in angular

I have a div which needs to be displayed if one of the radio button is selected else hidden. What i am trying is :

<body ng-controller="MainCtrl">
<form name="myForm" ng-submit="submitForm()">
<label><input type="radio" name="test" ng-model="radioValue" value="1"/> One</label>
<label><input type="radio" name="test" ng-model="radioValue" value="2"/> Two</label>
<label><input type="radio" name="test" ng-model="radioValue" value="3"/> Three</label>
<div>currently selected: {{radioValue}}</div>
<div ng-show = "{{radioValue}}=='1'">
<p> Metric Test values</p>
<b> Src: Value1 </b>
<b> Metric1: Value2 </b>
<b> Density: Value3 </b>
<button type="submit">Submit</button>

However i am not able to display the div irrespective of the combobox selected or not

Answer Source

Remove the {{}} for radioValue for ng-show like below

<div ng-show = "radioValue=='1'">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download