<p class="form-group">
<label class="block">
虚拟用户
</label>
<p class="clip-radio radio-primary">
<input type="radio" id="us-novirtual" name="virtualed" value="false" ng-model="user.virtual" >
<label for="us-novirtual">
否
</label>
<input type="radio" id="us-virtual" name="virtualed" value="true" ng-model="user.virtual" >
<label for="us-virtual">
是
</label>
</p>
</p>
<p class="form-group" ng-show="user.virtual">
<label class="control-label">
{{user.virtual}}
</label>
<input type="text" placeholder="请输入新密码" class="form-control" name="password" ng-model="user.password" value="">
</p>
请问当{{user.virtual}}随着上面的输入true false值变换的时候,为什么ng-show不会随着值得变化相应显示或者消失呢?
The true and false you entered are strings. Angular determines that the string is not empty, so user.virtual = true, so it will not disappear. Did you initialize data for user.virtual in the background?