angular.js - ng-show不能正常使用是为什么?
淡淡烟草味
淡淡烟草味 2017-05-15 17:00:55
0
1
544
                                        <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不会随着值得变化相应显示或者消失呢?
淡淡烟草味
淡淡烟草味

reply all(1)
滿天的星座

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?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template