AngularJS ng-selected 指令
AngularJS 教程
· 2019-04-02 06:39:32
AngularJS 实例
获取选中的选项:
点击复选框选择 BMW 选项:
<input type="checkbox" ng-model="mySel">
<p>我喜欢的车:</p>
<select>
<option>Volvo</option>
<option ng-selected="mySel">BMW</option>
<option>Ford</option>
</select>
<input type="checkbox" ng-model="mySel">
<p>我喜欢的车:</p>
<select>
<option>Volvo</option>
<option ng-selected="mySel">BMW</option>
<option>Ford</option>
</select>
定义和用法
ng-selected 指令用于设置 <select> 列表中的 <option> 元素的 selected 属性。
ng-selected 属性的表达式返回 true 则选项被选中。
语法
<option ng-selected="expression"></option>
<option> 元素支持该指令。
参数值
| 值 | 描述 |
|---|---|
| expression | 如果表达式为 true 则选项被选中 |
点击查看所有 AngularJS 教程 文章: https://www.codercto.com/courses/l/36.html
The Apache Modules Book
Nick Kew / Prentice Hall PTR / 2007-02-05 / USD 54.99
"Do you learn best by example and experimentation? This book is ideal. Have your favorite editor and compiler ready-you'll encounter example code you'll want to try right away. You've picked the right......一起来看看 《The Apache Modules Book》 这本书的介绍吧!