1 ng-model="standardCourse.showHours"代替name
2 ng-selected = "1"代替selected="selected",但问题是select下会多出一个无用的option
3 在数据准备时设置,$scope.standardCourse.showHours= '1';
解决多出的一个无用的option


<label for="_sel_show_hours">是否显示课时数</label>
<select id="sel_show_hours" ng-model="standardCourse.showHours" >
<option value="1" ng-selected = "1">显示</option>
<option value="0">不显示</option>

</select>  


radio也是 ng-checked="1",也需要准备数据时设置默认值

准备数据参考
$stateProvider.state('home.standardCourseAdd', {
        url: "/standardCourse/add",
        templateUrl: "/partials/ace/standardCourse/add.html",
        controller: function ($rootScope, $http, $scope, $location, $anchorScroll, $stateParams, $state, $timeout, $compile, Upload) {
            fnPost($scope, $state, $http, {'name': ''}, '/standardCourse/toAdd.do', function (success, data) {
                $scope.standardCourse = data.entity;
                $scope.standardCourse.showHours= '1';

});  

angularjs的select使用及默认选中的更多相关文章

  1. html select 标签设置默认选中

    方法有两种. 第一种通过<select>的属性来设置选中项,此方法可以在动态语言如php在后台根据需要控制输出结果. 1 2 3 4 5 < select  id =  " ...

  2. select 使其默认选中文本不为空

    ```html<select ref="type" v-model="selectedvalue" > <option v-for=" ...

  3. select遍历list默认选中初始值

    <select id="userstatus" name="userstatus">         <c:forEach items=&qu ...

  4. HTML中的<select>标签如何设置默认选中的选项

    方法有两种. 第一种通过<select>的属性来设置选中项,此方法可以在动态语言如php在后台根据需要控制输出结果. 1 2 3 4 5 < select  id =  " ...

  5. struts2设置<s:select>默认选中项的方法

    struts2的select标签中,常用的有以下几个属性:(1)struts2中的select 标签中,必须设置的属性只有一个,即是list.(2)select标签的list中必须有值,不然会报错.如 ...

  6. jQuery 设置select默认选中问题

    在进行其他操作后,恢复select默认选中 html代码: <select id="shai" style="width:150px;margin:5px 50px ...

  7. 修改select下拉选的默认选中值

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  8. Vue 中select option默认选中的处理方法

    在做泰康项目的时候有个需求就是要给select默认选中的样式我的处理方法有两个 1.直接将默认值给  selectedOption <select v-model="selectedO ...

  9. AngularJS的select设置默认值

    AngularJS的select设置默认值 在使用Angular时候使用select标签时会遇到绑定数据指定默认显示值可这样实现 <!DOCTYPE html> <html ng-a ...

随机推荐

  1. Python笔记(十九)_继承

    继承 继承可以把父类的所有功能都直接拿过来,这样就不必从零做起,子类只需要新增自己特有的方法,也可以把父类不适合的方法覆盖重写 多重继承 通过多重继承,一个子类就可以同时获得多个父类的所有功能 > ...

  2. luoguP3391[模板]文艺平衡树(Splay) 题解

    链接一下题目:luoguP3391[模板]文艺平衡树(Splay) 平衡树解析 这里的Splay维护的显然不再是权值排序 现在按照的是序列中的编号排序(不过在这道题目里面就是权值诶...) 那么,继续 ...

  3. CodeChef Sereja and GCD

    Sereja and GCD   Problem code: SEAGCD   Submit All Submissions   All submissions for this problem ar ...

  4. 状压BFS

    ​题意:1个机器人找几个垃圾,求出最短路径. 状压BFS,这道题不能用普通BFS二维vis标记数组去标记走过的路径,因为这题是可以往回走的,而且你也不能只记录垃圾的数量就可以了,因为它有可能重复走同一 ...

  5. 怕忘记了CSS中position的absolute和relative用法

    CSS2.0中的定位确实有时会把人弄糊涂,所以今天给它记下来,同时供以后查阅.下面写的内容有一部分借鉴了w3cschool和divcss5这两个官方网站,在此处特别的说明一下 CSS2.0中posit ...

  6. P3452 [POI2007]BIU-Offices(链表+bfs)

    P3452 [POI2007]BIU-Offices 新姿势:链表存图快速删除 显然两个没有直接相连的点要放到同一个集合里 但是直接搞一个图的补图会挂掉 考虑用链表维护点序列 每次bfs删除一个点和与 ...

  7. jenkinsapi和python打包工具的安装日志

    Successfully installed PyInstaller-3.3.1 altgraph-0.15 dis3-0.1.2 future-0.16.0 macholib-1.9 pefile- ...

  8. 实现combobox模糊查询的时候报错 InvalidArgument=“0”的值对于“index”无效

    因为要对combobox实现模糊查询,因为系统实现的匹配只能从左到右进行匹配,所以利用两个list来进行模糊匹配,主要代码如下: List<string> listOnit = new L ...

  9. JavaScript中的反柯里化

    转载自:https://www.cnblogs.com/zztt/p/4152147.html 柯里化 柯里化又称部分求值,其含义是给函数分步传递参数,每次传递参数后部分应用参数,并返回一个更具体的函 ...

  10. 2019-9-8-WPF-渲染原理

    title author date CreateTime categories WPF 渲染原理 lindexi 2019-9-8 10:40:0 +0800 2018-7-15 16:2:47 +0 ...