1. <i id='lGraz'><tr id='lGraz'><dt id='lGraz'><q id='lGraz'><span id='lGraz'><b id='lGraz'><form id='lGraz'><ins id='lGraz'></ins><ul id='lGraz'></ul><sub id='lGraz'></sub></form><legend id='lGraz'></legend><bdo id='lGraz'><pre id='lGraz'><center id='lGraz'></center></pre></bdo></b><th id='lGraz'></th></span></q></dt></tr></i><div id='lGraz'><tfoot id='lGraz'></tfoot><dl id='lGraz'><fieldset id='lGraz'></fieldset></dl></div>

      <bdo id='lGraz'></bdo><ul id='lGraz'></ul>

    <small id='lGraz'></small><noframes id='lGraz'>

    1. <legend id='lGraz'><style id='lGraz'><dir id='lGraz'><q id='lGraz'></q></dir></style></legend>
      <tfoot id='lGraz'></tfoot>

      选择框中的角度布尔值

      Angular, boolean value in a select box(选择框中的角度布尔值)

          <bdo id='5vzKd'></bdo><ul id='5vzKd'></ul>

          <i id='5vzKd'><tr id='5vzKd'><dt id='5vzKd'><q id='5vzKd'><span id='5vzKd'><b id='5vzKd'><form id='5vzKd'><ins id='5vzKd'></ins><ul id='5vzKd'></ul><sub id='5vzKd'></sub></form><legend id='5vzKd'></legend><bdo id='5vzKd'><pre id='5vzKd'><center id='5vzKd'></center></pre></bdo></b><th id='5vzKd'></th></span></q></dt></tr></i><div id='5vzKd'><tfoot id='5vzKd'></tfoot><dl id='5vzKd'><fieldset id='5vzKd'></fieldset></dl></div>
          <legend id='5vzKd'><style id='5vzKd'><dir id='5vzKd'><q id='5vzKd'></q></dir></style></legend>
            <tbody id='5vzKd'></tbody>

            1. <tfoot id='5vzKd'></tfoot>
            2. <small id='5vzKd'></small><noframes id='5vzKd'>

                本文介绍了选择框中的角度布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想使用选择将布尔值设置为 true 或 false,这是我的代码:

                I want to set a boolean value to true or false using a select here is my code:

                <select class="span9" ng-model="proposal.formalStoryboard">
                <option value="false">Not Included</option>
                <option value="true">Included</option>
                </select>
                

                值 (proposal.formalStoryboard) 已正确设置为 true 或 false 但当该值已分配时,更改不会反映在选择框上.

                The value (proposal.formalStoryboard) is set properly to true or false but the change are not reflected on the select box when the value is already assigned.

                我尝试了 ng-value="true" 和 ng-value="false" 而不仅仅是 value,但效果不佳.

                I tried ng-value="true" and ng-value="false" instead of just value but it's not working as well.

                推荐答案

                评论者指出我原来的解决方案并没有像声称的那样工作.我已更新答案以反映下面其他人给出的正确答案(我无法删除已接受的答案).

                Commentors have pointed out that my original solution did not work as claimed. I have updated the answer to reflect the correct answer given by others below (I cannot delete an accepted answer).

                对于 Angular 1.0.6,请考虑以下 HTML:

                For Angular 1.0.6, consider this HTML:

                <div ng-app="">
                  <div ng-controller="MyCntrl">
                    <select ng-model="mybool"
                            ng-options="o.v as o.n for o in [{ n: 'Not included', v: false }, { n: 'Included', v: true }]">
                    </select>
                    <p>
                        Currently selected: <b>{{ mybool }}</b> opposite: {{ !mybool }}
                   </p> 
                 </div>
                </div>
                

                还有这个 JavaScript:

                And this JavaScript:

                function MyCntrl($scope) {
                    $scope.mybool = true;
                }
                

                这是一个适用于 Angular 1.0.6 的 DEMO,这是一个有效的 DEMO,略有不同.

                Here is a working DEMO for Angular 1.0.6 and here is a working DEMO for Angular 1.3.14, which is slightly different.

                这篇关于选择框中的角度布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)

                <small id='CIzP9'></small><noframes id='CIzP9'>

                    <bdo id='CIzP9'></bdo><ul id='CIzP9'></ul>
                    <i id='CIzP9'><tr id='CIzP9'><dt id='CIzP9'><q id='CIzP9'><span id='CIzP9'><b id='CIzP9'><form id='CIzP9'><ins id='CIzP9'></ins><ul id='CIzP9'></ul><sub id='CIzP9'></sub></form><legend id='CIzP9'></legend><bdo id='CIzP9'><pre id='CIzP9'><center id='CIzP9'></center></pre></bdo></b><th id='CIzP9'></th></span></q></dt></tr></i><div id='CIzP9'><tfoot id='CIzP9'></tfoot><dl id='CIzP9'><fieldset id='CIzP9'></fieldset></dl></div>
                    • <legend id='CIzP9'><style id='CIzP9'><dir id='CIzP9'><q id='CIzP9'></q></dir></style></legend>

                        1. <tfoot id='CIzP9'></tfoot>
                            <tbody id='CIzP9'></tbody>