我使用以下代码在范围var newclient = true上显示默认选项,newclient通过下面显示的链接设置为true / false。不幸的是,当newclient为true时,ng-selected不会选择该选项作为默认选项。有人可以告诉我我在这里做错了什么以及如何解决它?感谢
<select ng-disabled="newclient" name="clients" id="clients">
<option value="0">
Select Client...
</option>
<option ng-selected="newclient" value="1">
Create New Client
</option>
</select>
<a href="" ng-click="newclient = !newclient"></a>
答案 0 :(得分:0)
尝试在href链接文本中添加一些内容(例如,“TOGGLE-ME”),使其可点击...当您单击它时,它对我有效:
<select ng-disabled-REMOVED="newclient" name="clients" id="clients">
<option value="0">
Select Client...
</option>
<option ng-selected="newclient" value="1">
Create New Client
</option>
</select>
<a href="" ng-click="newclient = !newclient">TOGGLE-ME</a>