angularjs – 如何选择工作?
发布时间:2020-12-17 07:43:15 所属栏目:安全 来源:网络整理
导读:这是一个片段. Q2是按照我预期的. select name="quarter" ng-model="Quarter" option value="1" Q1/option option value="2" ng-selected="Quarter=='Q1'"Q2/option option value="3"Q3/option option value="4"4/option/select 将“Q1”更改为“Q2”,不会像
这是一个片段. Q2是按照我预期的.
<select name="quarter" ng-model="Quarter" > <option value="1" >Q1</option> <option value="2" ng-selected="Quarter=='Q1'">Q2</option> <option value="3">Q3</option> <option value="4">4</option> </select> 将“Q1”更改为“Q2”,不会像我预期的那样选择.现在把ng-selected =“Quarter ==’Q1’”不要让Q1被选中,直到我删除ng-selected =“Quarter ==’Q2” 跆拳道.这是如何工作的?
如果在选项元素上放置了ng选择,则当ng选定的值为true时,将选择该选项.在您的情况下,当Quarter等于Q1时,选择Q2.
如果要选择在Quarter中传递的值,则必须在select元素上放置ng: <select name="quarter" ng-model="Quarter" ng-selected="Quarter" ng-options="Quarter for Quarter in Quarters" > {{Quarter}} </select> 看看select directive documentation. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |