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. Fitness初接触

    http://www.fitnesse.org/FitNesseDownload 1. Click on the most recent fitnesse-standalone.jar file an ...

  2. Vue-实现简单拖拽(自定义属性)

    <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"& ...

  3. jQuery基础--插件

    1. 插件 1.1. 常用插件 插件:jquery不可能包含所有的功能,我们可以通过插件扩展jquery的功能. jQuery有着丰富的插件,使用这些插件能给jQuery提供一些额外的功能. 1.1. ...

  4. Powershell read XML format config file

    upload.xml<?xml version="1.0" ?> <ftpConfig> <Protocol>ftp</Protocol& ...

  5. Spring cloud学习--Zuul02

    过滤器 Zuul包括两部分内容:请求的路由和过滤.而实际上请求的路由也是通过过滤器实现的,例如理由映射主要通过pre类型的过滤器完成,它将请求路径与配置的路由规则进行匹配,找到需要转发的目标地址:请求 ...

  6. 设置div标签可以输入文字

    1.contenteditable 属性可以设置div标签为克输入标签,   2.input和textarea虽然是常用的输入标签,但是这两个标签不能设置最大高度和最小高度, 随意如果想随着输入的内容 ...

  7. 11、numpy——字符串函数

    NumPy 字符串函数 以下函数用于对 dtype 为 numpy.string_ 或 numpy.unicode_ 的数组执行向量化字符串操作. 它们基于 Python 内置库中的标准字符串函数. ...

  8. A Bug’s Life POJ - 2492(种类并查集)

    题目链接 每次给出两个昆虫的关系(异性关系),然后发现这些条件中是否有悖论 就比如说第一组数据 1 2 2 3 1 3 1和2是异性,2和3是异性,然后说1和3是异性就显然不对了. 我们同样可以思考一 ...

  9. k8s nginx ingress配置TLS

    在没有配置任何nginx下,k8s的nginx默认只支持TLS1.2,不支持TLS1.0和TLS1.1 默认的 nginx-config(部分可能叫 nginx-configuration)的配置如下 ...

  10. JS的video获取时长,出现问题汇总

    <video id="my_video_1" controls="controls" style=" width: 700px; height: ...